Skip to content

Instantly share code, notes, and snippets.

View onewland's full-sized avatar

Oliver Newland onewland

  • San Francisco, CA
View GitHub Profile
@onewland
onewland / strstr.rb
Created December 6, 2010 16:27 — forked from rachelmyers/strstr
def substring(haystack, needle)
0.upto(haystack.length) do |i|
return i if haystack[i,(needle.length)] == needle
end
return nil
end
puts substring("stupid", "smart")
puts substring("stupid", "stu")
puts substring("stupid", "pid")
@onewland
onewland / cron-test.js
Created November 18, 2009 21:35 — forked from fwg/cron-test.js
corrected cron.js
// Sample for http://oliveriskindoffunny.tumblr.com/post/247975858/implementing-a-user-friendly-cron-module-with-node-js
var cron = require('./cron'), sys = require('sys');
cron.Every((2).seconds(), function() { sys.puts('Working!'); });