Skip to content

Instantly share code, notes, and snippets.

View hannahherbig's full-sized avatar

Hannah Herbig hannahherbig

View GitHub Profile
>> o = GitHub.org('github')
=> #<GitHub::Organization avatar_url="https://secure.gravatar.com/avatar/61024896f291303615bcd4f7a0dcfb74?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png" blog="https://github.com/about" company=nil created_at="2008-05-11T04:37:31Z" email="support@github.com" followers=622 following=0 html_url="https://github.com/github" id=9919 location="San Francisco, CA" login="github" name="GitHub" public_gists=0 public_repos=36 type="Organization" url="https://api.github.com/orgs/github">
>> o.login
=> "github"
>> o.id
=> 9919
>> o.company
=> nil # yes, this is right. it's nil above, which is what the api returns for whatever reason
>> o.type
=> "Organization"
@hannahherbig
hannahherbig / clock.rb
Created December 4, 2011 03:02
polar clock in Shoes
def helper from_edge, number
twopi = Shoes::TWO_PI
angle1 = twopi / 4 * 3
angle2 = (angle1 + number * twopi) % twopi
width = @clock.width
radius = width - from_edge * 2
arc width / 2, width / 2, radius, radius, angle1, angle2
end
@hannahherbig
hannahherbig / merge.coffee
Created December 21, 2011 17:54
merge function
_ = require 'underscore'
# merge all the objects together into one
# e.g.
# merge({ one: 1, two: 5 }, { two: 2 })
# { one: 1, two: 2 }
merge = (objects...) ->
result = {}
for obj in objects
_(obj).each (value, key) ->
irc = require 'irc'
twitter = require 'ntwitter'
bot = new irc.Client 'irc.mcintec.net', 'node',
channels: ['#twitter']
twit = new twitter
consumer_key: ''
consumer_secret: ''
access_token_key: ''
@hannahherbig
hannahherbig / parse.coffee
Created December 22, 2011 23:10
irc parser
module.exports = parse = (str) ->
origin = null
command = null
args = []
# pull out the origin if there is one
if str[0] is ':'
i = str.indexOf ' '
origin = str.slice 1, i
str = str.slice i + 1
source :rubygems
gem 'foreman'
gem 'stalker'
gem 'clockwork'
%ul
%li dick1
%li dick2
@hannahherbig
hannahherbig / life.rb
Created April 20, 2012 05:49
conway's game of life
# conway's game of life
col = 50
row = 50
# set this up however you want, i like randomness.
env = col.times.map { row.times.map { 0 == rand(2) } }
loop do
puts "-" * col
shot() {
for file in "/Users/andrew/Desktop/Screen Shot"*
do
hash=`shasum $file | awk '{ print $1 }'`
new="$hash.png"
mv $file "/Users/andrew/Dropbox/Public/files/$hash.png"
echo "$file => http://dl.dropbox.com/u/5489165/files/$hash.png"
done
}
@hannahherbig
hannahherbig / gist:3164717
Created July 23, 2012 16:59
my autoexec.cfg for cs:s
cl_ragdoll_physics_enable 0
alias _voice_toggle _voice_on
alias _voice_on "alias _voice_toggle _voice_off; +voicerecord"
alias _voice_off "alias _voice_toggle _voice_on; -voicerecord"
alias _demo_pause_toggle _demo_pause_on
alias _demo_pause_on "alias _demo_pause_toggle _demo_pause_off; demo_pause"
alias _demo_pause_off "alias _demo_pause_toggle _demo_pause_on; demo_resume"