Skip to content

benjaminoakes/snippets

Repository files navigation

Snippets

Description

These are little snippets of programs I write when I test out ideas. Rather than throw them away, I store them here for the inevitable day when I think "gosh, how did I do that again?" or "did that actually work?" Many are written quickly and off the cuff.

I write primarily in Ruby, which is reflected here. Feel free to fork and add your own.

This gives a kind of rough idea of how much I know about a given language -- the more snippets I've had to make, the more I've probably written. Even so, I've only made these heavily for the last couple years, they're not complete, and only include languages that I can easily call up in the terminal of my Macs or Linux boxes.

Layout

I've organized the snippets by language, each language having its own directory. The title of each file should give a clue about its purpose. Keep in mind, however, that some of these are written quickly and aren't necessarily well documented. (They're "prototype" or "experimental" code.)

Many files are called something like foo_sandbox because some languages (like Ruby) will not find external libraries correctly if they have the same name as the current file. It can cause annoying bugs (which is why I gained the habit of adding _sandbox on the end).

Where do I go from here?

Here are some high points to visit.

Useful Ruby:

analyze_load_average.rb
average_minutes_used_a_month.rb
compare_csv.rb
extract_tag_content.rb
find_non_ascii_characters_in_file.rb
gmail_imap.rb
readline_sandbox.rb
word_wrap.rb

Explanatory Ruby:

inline_factorial_comparison.rb
module_constants.rb
module_inside_module.rb
object_space_finalizers.rb

Wicked-awesome AppleScript (if there is such a thing):

"Play playlist.applescript" # Voice-controlled.  Seriously.
"Play latest NBC Nightly News fullscreen.applescript"

And the ever-popular birthday programs:

c/birthday.c
css/rainbow_shadow.rb 

(I've been adding to those each time someone's birthday comes around.)

Disclaimer

I make no guarantee of any of this code functioning or serving any specific need. (I do try to mark code that doesn't work, though.) These programs are here primarily for educational or reference value.

That being said, I do hope you find them useful. (I'd love to hear from you if so.)

About

Stuff I write to test out ideas. Little programs that are worth keeping around.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published