Skip to content

Instantly share code, notes, and snippets.

@jstorimer
jstorimer / gist:2361333
Created April 11, 2012 18:49
Resources about giving good talks
>> IO.for_fd(3)
ArgumentError: The given fd is not accessible because RubyVM reserves it
from (irb):23:in `for_fd'
from (irb):23
from /Users/jessestorimer/.rbenv/versions/1.9.3-p0-perf/bin/irb:12:in `<main>'
>> IO.for_fd(4)
ArgumentError: The given fd is not accessible because RubyVM reserves it
from (irb):24:in `for_fd'
from (irb):24
from /Users/jessestorimer/.rbenv/versions/1.9.3-p0-perf/bin/irb:12:in `<main>'
commit bcdaf11bfeac9b6015d981a95cd375c61c3a2b11
Author: Jesse Storimer <jstorimer@gmail.com>
Date: Sun Jan 1 05:50:53 2012 -0800
diff --git a/learning_basic_programming.md b/learning_basic_programming.md
index 06a953f..ffc4945 100644
--- a/learning_basic_programming.md
+++ b/learning_basic_programming.md
@@ -14,7 +14,7 @@ Start off by giving [Try Ruby](http://tryruby.org/ an in-browser programming tut
@jstorimer
jstorimer / learning_basic_programming.md
Created January 1, 2012 13:49 — forked from edward/learning_basic_programming.md
Tech-ing Up: Learning basic programming

Tech-ing Up: Learning basic programming

Coming from http://www.reddit.com/r/canada/comments/m1494/looking_for_a_developer_advocate_for_shopify/ or elsewhere? Awesome.

This is a guide for learning the bare minimum needed for effectively working as a junior programmer or developer advocate at most software companies.

If you haven’t ever programmed before, don’t sweat it. Those who would be good fits at this job are naturally attuned to this stuff and their innate curiosity makes it a cakewalk. If you’re finding that it’s a frustrating experience the entire way through, then you should consider doing something else for a little while before you come back to give it another shot.

A first stab at programming

#!/usr/bin/env ruby
pattern = ARGV.shift
data = ARGF.read
data.each_line do |line|
exit if line.match(pattern)
end
abort "No matches found"
@jstorimer
jstorimer / hilong.rb
Last active July 30, 2020 06:52
hilong -- A simply utility to show character counts for each line of input and highlight lines longer than 80 characters.
#!/usr/bin/env ruby
# A simply utility to show character counts for each line of input and
# highlight lines longer than 80 characters.
#
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html
#
# Examples:
#
# $ hilong Gemfile
#!/bin/sh -e
# Usage: license
# Prints an MIT license appropriate for totin' around.
#
# $ license > COPYING
#!/bin/sh
echo "Copyright (c) `date +%Y` Jesse Storimer
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
#!/usr/bin/env coffee
# A useful little script to execute a shell command when another
# command exits successfully. Kind of like using && except the
# first command will keep executing until it returns successfully.
#
# My use case was starting up a local rails server. It takes ~15
# seconds and I have no indication of when it's ready besides manually
# polling lsof. So with this script I just do the following to start
# profiling my app when it's online.
require 'rake/testtask'
Rake::TestTask.new('tester') do |t|
t.test_files = 'test/*.rb'
end
#!/usr/bin/env ruby
# Put me in ~/bin/branch_date
ref = ARGV[0]
date = `git show --format='%at' #{ref} | head -1`.strip
puts "#{date}:#{ref}"