Skip to content

Instantly share code, notes, and snippets.

View listrophy's full-sized avatar

Brad Grzesiak listrophy

View GitHub Profile
@listrophy
listrophy / mockingbird.rb
Created October 9, 2012 23:20
Mockingbird example
class Mockingbird < ActiveRecord::Base
attr_accessible :color
def chirp!
"chirp"
end
def tweet!
"tweet"
end
@listrophy
listrophy / gist:3827302
Created October 3, 2012 14:45
TravisCI.app endpoints
honor TravisCI(原+*-) ack -ua 'json' TravisCI
TravisCI/BWBuild+Presenter.m
22: NSString *resourcePath = [NSString stringWithFormat:@"/builds/%@.json", self.remote_id];
TravisCI/BWJob+Presenter.m
142: NSString *resourcePath = [NSString stringWithFormat:@"/jobs/%@.json", self.remote_id];
TravisCI/BWRepository+Presenter.m
21: NSString *resourcePath = [NSString stringWithFormat:@"/repositories/%@.json", remote_id];
31: NSString *resourcePath = [NSString stringWithFormat:@"/repositories/%@/builds.json", self.remote_id];
@listrophy
listrophy / main_screen.coffee
Created September 25, 2012 19:31
Singleton class in Coffeescript
MainScreen = new class extends Screen
doSomething: (window) ->
window.buttons()[0].tap()
<!DOCTYPE html>
<html>
<head>
<%= stylesheet_link_tag 'tt_report', :plugin => 'redmine_time_tracker', :media => "all" %>
<%= javascript_include_tag 'mootools/mootools-core-1.4.5-full-compat-yc.js', :plugin => 'redmine_time_tracker' %>
<%= javascript_include_tag 'mootools/mootools-more-1.4.0.1.js', :plugin => 'redmine_time_tracker' %>
<%= javascript_include_tag 'MilkChart.yc.js', :plugin => 'redmine_time_tracker' %>
</head>
<body>
<table style="width: 100%;">
<div id="article-body">
<p style="text-align: left">
<img alt="" src="/Restaurant%20Week/RW%202012%20Summer/RWS12-1.jpg" style="width: 610px; height: 200px"></p>
<h1 style="text-align: center">
<font color="#000000">             43 North<a href="http://www.madisonmagazine.com/Madison-Magazine/Events/Restaurant-Week/Participants/Avenue/"><img alt="" src="/Restaurant%20Week/RW%20WINTER/Left.jpg" style="width: 100px; height: 30px"></a></font>
</h1>
<p style="text-align: center">
<font color="#339999">108 King Street Madison 53705 608.255.4343 Hours: Mon-Sun 5-10p</font><font color="#339999"> <a href="http://43north.biz/" target="_blank"><font color="#339999">Website</font></a></font></p>
<h3 style="text-align: center">
<font color="#336666">Dinner Menu</font>
@listrophy
listrophy / validate.rb
Created May 17, 2012 22:56
Credit card number validator?
# Do NOT assume this is production code.
class String
def to_is
self.chars.map(&:to_i)
end
end
def luhn cc
cc.
@listrophy
listrophy / stdout
Created April 25, 2012 17:38
UIATargetHasGoneAWOLException
honor TravisCI(原*) rake test
running: /Users/brad/dev/bwoken/bin/unix_instruments.sh -D /Users/brad/dev/ios/TravisCI/integration/tmp/trace -t /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -v /Users/brad/dev/ios/TravisCI/build/TravisCI.app -e UIASCRIPT /Users/brad/dev/ios/TravisCI/integration/tmp/javascript/iphone/favorites.js -e UIARESULTSPATH /Users/brad/dev/ios/TravisCI/integration/tmp/results
Instruments : Plugin Search Paths (
"/Users/brad/Library/Application Support/Instruments/PlugIns",
"/Library/Application Support/Instruments/PlugIns",
"/Applications/Xcode.app/Contents/Developer/usr/PlugIns",
"/Applications/Xcode.app/Contents/Developer/usr/bin/PlugIns",
"/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns",
"/Applications/Xcode.app/Contents/Developer/Library/Instruments/PlugIns",
@listrophy
listrophy / roman.rb
Created April 11, 2012 17:00
To/From Roman numerals
class Fixnum
def to_roman
return '' if self == 0
roman, arabic = {
M: 1000,
CM: 900,
D: 500,
CD: 400,
C: 100,
XC: 90,
@listrophy
listrophy / ugh.sh
Created March 27, 2012 17:15
simulate instruments' behavior
#!/usr/bin/env bash
if [[ "$1" == "--fail" ]]
then
echo 'Instruments Trace Error'
fi
if [ -t 1 ]
then
echo A
@listrophy
listrophy / foo.js
Created October 17, 2011 22:59
Slug-compilation-time Asset Precompilation
// ...
// source pretty-printed
// some values elided/obscured since I'm not sure which ones are sensitive... though the one's remove are certainly not able to be keyed off of
foo = [
["DATABASE_URL","postgres://user:pass@127.0.0.1/dbname"],
["SSH_CLIENT","10.194.1.1 12345 12346"],
["USER","xxxxxx"],
["MAIL","/var/mail/xxxxxx"],
["RAILS_GROUPS","assets"],
["SHLVL","1"],