This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: ruby timecard.rb path branch name-of-graph-file-not-including-extension | |
# e.g.: ruby timecard.rb . master timecard #=> produces timecard.png | |
require 'rubygems' | |
# This requires the 'cyberfox-gchart' gem (0.5.4), as the standard | |
# gchart gem is woefully broken for this kind of graph. Broken to the | |
# point that it's an inherent design choice that doesn't work well for | |
# this kind of chart. I'm sure that the cyberfox-gchart gem won't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/local/bin/ruby | |
# supa primitive script to access today's journal entry text file | |
now = Time.now | |
month = now.month.to_s | |
month = "0" + month if month.to_i < 10 | |
day = now.mday.to_s | |
day = "0" + day if day.to_i < 10 | |
date = month + day + now.year.to_s[2,3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'fastercsv' | |
require 'active_support' | |
require File.dirname(__FILE__) + "/gruff/lib/gruff" # had some glitches with rubygems gruff | |
# cargo cult: http://blog.nikosd.com/2008/10/beautiful-bar-charts-with-ruby-and.html | |
g = Gruff::Bar.new('700x400') # Define a custom size | |
g.sort = false # Do NOT sort data based on values | |
g.theme_keynote # Declare a theme from the presets available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`ls input_dir/filenames*`.each_with_index do |image, index| | |
image.chomp! | |
image.gsub!(/ /, "\\\\ ") | |
filename = "output_dir/picture_#{index}.jpg" | |
system "convert -density 72 -size 400x300 #{image} #{filename} ; amazon -b my_bucket_name #{filename}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$("#button").click(function() { | |
alert("foo"); | |
$("#button").unbind().click(function() { | |
alert("bar"); | |
return false; | |
}); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'), | |
assert = require('assert'), | |
underscore = require('../vendor/underscore/underscore')._; | |
Array.prototype.drop = function() { | |
var recalculatedArray = _.compact(this); | |
for (var i = recalculatedArray.length; i < 7; i++) { | |
recalculatedArray[i] = null; | |
} | |
return recalculatedArray; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"), | |
sys = require("sys"), | |
buffer = (new Buffer(10000)); | |
fs.open("./jsfiles.list", "r", (function(err, fd) { | |
// err:required fd:required | |
return fs.read(fd, buffer, null, "utf8", (function(error, string, count) { | |
// error:required string:required count:required | |
return sys.puts(buffer.toString()); | |
})); | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sibilant foo.lisp bar | |
Error: ENOENT, No such file or directory '/dir_name/foo' | |
at Object.openSync (fs:153:18) | |
at Object.readFileSync (fs:94:15) | |
at Object.translateFile (/usr/local/lib/node/.npm/sibilant/0.0.9/package/lib/cli.js:116:48) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my first serious ruby question in like forever: | |
class Array | |
def token_diff(other) | |
memo = 0 | |
self.each_with_index do |element, index| | |
memo += 1 if other[index] != element | |
end | |
return memo | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<macbook of doom:giles> [01-02 13:49] ~ | |
↪ node | |
> 284.88 + 96.80 + 459 | |
840.6800000000001 |