Skip to content

Instantly share code, notes, and snippets.


Shad Reynolds shad

View GitHub Profile
View test.js
// this is a function!
function foo(bar) {
return 'baz';

Keybase proof

I hereby claim:

  • I am shad on github.
  • I am shadr ( on keybase.
  • I have a public key whose fingerprint is 7CBC 5E71 1662 E5AE D322 9809 DC8A 9DF7 BA30 351F

To claim this, I am signing this object:

shad / Rakefile
Created Mar 7, 2013
Simulate a really poor network connection on your mac (with support for backend). Ex. If you expect your users to use your app in a place with poor network (like the meat department of your local grocery store), then this is a way for you to test that sort of connection. This is not scientific in anyway, just a guess.
View Rakefile
# Simulate a really poor network connection on your mac (with support for backend)
namespace :network do
task :status do
sh 'sudo ipfw show'
task :bad => [:good] do
# Add a new pipe
sh 'sudo ipfw add pipe 1 all from any to any'
# Configure the pipe to only do 50Kbit/s, with typical delays of 2000ms and 90% packet drop rate!
sh 'sudo ipfw pipe 1 config bw 50Kbit/s delay 2000ms plr 0.9'
shad / gist:1367540
Created Nov 15, 2011 error
View gist:1367540
$~/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.5/iphone/ simulator "4.2" "." <MY-APP-ID> "My Cool App" iphone
...lines ommitted...
[INFO] Performing clean build
[ERROR] Error: Traceback (most recent call last):
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.5/iphone/", line 1093, in main
recompile = copy_tiapp_properties(project_dir)
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.5/iphone/", line 408, in copy_tiapp_properties
shutil.copy(os.path.join(project_dir, 'tiapp.xml'), assets_tiappxml)
shad / titanium-1.7.3.output
Created Oct 19, 2011
What I get when I try to build my app with Titanium 1.7.3
View titanium-1.7.3.output
~/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.3/iphone/ simulator "4.2" "." 554UNEM399 "Meal Planning by Food on the Table" iphone | grep -v "^$"
File "/Users/shad/Library/Application Support/Titanium/mobilesdk/osx/1.7.3/iphone/", line 1325
if command in ['simulator', 'build']:
IndentationError: expected an indented block
rake aborted!
Command failed with status (1): [~/Library/Application\ Support/Titanium/mo...]
shad / app.js
Created Mar 8, 2011
Modal + NavGroup + TableView + Complex Rows = Crash
View app.js
// Log info about the window and memory on close
function logClose(event) {
var closingWindow = event.source;'close window (' + closingWindow.title +') : ' + Ti.Platform.availableMemory);
// Create a row with a couple of subviews
function createRow(spec) {
var row = Ti.UI.createTableViewRow({
hasChild: true,
shad / jquery.setTimeout.js
Created Dec 15, 2010
Sometimes, it's useful to quickly set/clear a timeout that's attached to an element.
View jquery.setTimeout.js
* setTimeout
* Sometimes, we want to set a timeout and associate the timeout with
* an element. This is essential for operations that open menus, popups
* flyovers, etc.
* Shad Reynolds
shad / better-textmate-rspec-puts.rb
Created Mar 5, 2010
An Improved puts for rspec in Textmate.
View better-textmate-rspec-puts.rb
# Improved "puts" in Textmate's version of rspec
if ENV['TM_MODE'] == 'RSpec'
alias :orig_puts :puts
def puts(str)
str = '[nil]' if str.nil?
str = '' if str.blank?
url, line = caller[0].split(":")
md = caller[0].match(/[\\\/]([^\\\/]*:\d+):(.*)/)
link_text = md[1]
title = md[2]
shad / language_codes.js
Created Oct 13, 2009
Two letter language codes.
View language_codes.js
// from
(function () {
if (typeof LANGUAGE_CODES === 'undefined') {
{code:'aa', name:'Afar'},
{code:'ab', name:'Abkhazian'},
{code:'ae', name:'Avestan'},
{code:'af', name:'Afrikaans'},
{code:'ak', name:'Akan'},
{code:'am', name:'Amharic'},
View gist:202687
(function () {
var mylib = {};
window.MYLIB = mylib;