Skip to content

Instantly share code, notes, and snippets.

View wmw's full-sized avatar

William Warnecke wmw

  • California
  • X @ww
View GitHub Profile
import sys
import getopt
import re
class Field:
def __init__(self, key, desc, typeinfo):
self.key = key
self.desc = desc
self.typeinfo = typeinfo
@wmw
wmw / twitch.bat
Created October 13, 2013 21:15
livestreamer with stream name
cd c:\program files (x86)\livestreamer
set /p streamName=What stream?:
livestreamer.exe -url twitch.tv/%streamName% best
@wmw
wmw / pylog.py
Created September 11, 2013 17:52
logging python stuff
#!/usr/bin/python
import logging
import logging.handlers
import json
#
# http://docs.python.org/2/howto/logging-cookbook.html#implementing-structured-logging
#
module ExternalRelations
class Linkage
def initialize(relation, caller, opts)
opts = opts.clone
@key = (opts.delete(:id) || :id)
@caller = caller
@target = relation.to_s.singularize.camelize.constantize.scoped.where(:"#{@caller.class.to_s.downcase}_id" => @caller.send(@key))
end
def <<(new_link_target)
@wmw
wmw / to_hash.rb
Created February 2, 2011 23:54
Implementing a to_hash function for a class in ruby.
class Balls
def initialize()
@name = 'blah'
@caption = 'blah'
end
def to_hash
hash = self.instance_variables.inject({}) do |a, e|
hash = {e[1..-1] => self.instance_variable_get(e)}
require 'mm-paginate'
if ENV['MONGOHQ_URL']
MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGOHQ_URL']}}
else
MongoMapper.config = {RAILS_ENV => {'uri' => 'mongodb://localhost:27071/shapado-development'}}
end
MongoMapperExt.init
@wmw
wmw / callbacks.js
Created September 21, 2010 07:29 — forked from mmcgrana/callbacks.js
})})})})})})})})})});
<session>
<token>SNIP</token>
<var name="customerName" value="Bill" />
<var name="numberToDial" value="SNIP" />
<var name="message" value="Test Message" />
</session>
Friday:
Wale
Street Sweeper Social Club
Passion Pit
Lax Roux / Grizzly Bear
LCD SoundSystem
Vampire Weekend
Deadmau5 (though I really would like to see Jay-Z live too.)
LamePS
Funkstrong
Waldizzzo
jonogotoo
christide
moogle_
r3plica1337
TivoliPSN
weirdo513
ngerakines