Skip to content

Instantly share code, notes, and snippets.

@sambao21
sambao21 / gist:987448
Created May 23, 2011 19:57
Get 3 stars on angrybirds
javascript: var i = 0; while (i<=69) {
localStorage.setItem('level_star_'+i,'3'); i++;
}
window.location.reload();
@sambao21
sambao21 / gist:994664
Created May 27, 2011 04:54
angry birds, king and 5 birds
(function () {
var RealXMLHttpRequest = XMLHttpRequest;
var FakeXMLHttpRequest = function () {
this._req = new RealXMLHttpRequest();
};
FakeXMLHttpRequest.prototype = {
abort: function () {
this._req.abort.apply(this._req, arguments);
},
getAllResponseHeaders: function () {
@sambao21
sambao21 / gist:2401117
Created April 16, 2012 20:01
virtualenvwrapper postmkvirtualenv
#!/bin/zsh
# This hook is run after a new virtualenv is activated.
echo "Do you want to install ipython & bpython?"
select yn in "Yes" "No"; do
case $yn in
Yes )
pip install ipython bpython;
easy_install readline;
break;;
No )
@sambao21
sambao21 / pip-cache-install.py
Created May 1, 2012 13:43 — forked from jacobian/pip-cache-install.py
Install a package from your local pip download cache without touching the 'net. (edit: will pip install normally if can't find in cache)
#!/usr/bin/env python
"""
Install a package from your local pip download cache without having to touch
the 'net at all.
You'll need to be using a pip download cache; that is, you'll need the
following in your ~/.pip/pip.conf:
[install]
@sambao21
sambao21 / gist:4006459
Created November 3, 2012 07:42
rename files for transfer to ipad
import os
upDir = '/Users/sambao21'
rootDir = '{0}/ipad_pics'.format(upDir)
y = 100
for dirName,subdirList,fileList in os.walk( rootDir ) :
print "Found directory:" , dirName
x = 0
for fname in fileList:
path = dirName + '/'
@sambao21
sambao21 / gist:4063478
Created November 13, 2012 02:03
backly fontello icons
.icon-heart:before { content: '\2665'; } /* '♥' */
.icon-cog:before { content: '\2699'; } /* '⚙' */
.icon-edit:before { content: '\270d'; } /* '✍' */
.icon-comment:before { content: '\e718'; } /* '' */
.icon-left-open:before { content: '\e75d'; } /* '' */
.icon-right-open:before { content: '\e75e'; } /* '' */
.icon-left-open-big:before { content: '\e765'; } /* '' */
.icon-right-open-big:before { content: '\e766'; } /* '' */
.icon-facebook-rect:before { content: '\f301'; } /* '' */
.icon-twitter-bird:before { content: '\f303'; } /* '' */
@sambao21
sambao21 / gist:4247542
Created December 9, 2012 23:46
rooting nexus 4 on OSX
  1. Make sure device USB debugging mode turned on (Google around for the latest instructions)
  2. Install Android SDK - http://developer.android.com/sdk/index.html#download (Follow direction kinda outlined here - http://forum.xda-developers.com/showthread.php?t=1917237 adjust as necessary because these instructions probably will be outdated.)
  3. Create ~/android
  4. Unzip the sdk into ~/android
  5. Make sure tools and platform-tools directory are there, if not install, by running ~/android/adt-bundle-mac/sdk/tools/android.
  6. Make sure adb and fastboot are installed in ~/android/adt-bundle-mac/sdk/platform-tools/
  7. Export $PATH to include ~/android/adt-bundle-mac/sdk/platform-tools so we can access adb and platform-tools from anywhere
  8. Download CWM Touch and place it in ~/android - http://clockworkmod.com/rommanager
@sambao21
sambao21 / gist:5076144
Created March 3, 2013 13:46
work mbp sublime text settings
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/Railscasts.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",
@sambao21
sambao21 / sambao21.zsh-theme
Created March 5, 2013 03:34
My oh-my-zshell theme
local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
local user='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg_bold[green]%}%p%{$fg[blue]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%{$reset_color%}'
local time="%{$fg[white]%}%{$fg[yellow]%}%T%{$fg[white]%}%{$reset_color%}"
local ruby="%{$fg[white]%}[%{$fg[magenta]%}\$(rvm-prompt i v g)%{$fg[white]%}]%{$reset_color%}"
@sambao21
sambao21 / sessions.md
Created May 8, 2013 17:42
Aaron and Sam's RailsConf 2013 session attended mashup

Monday

  • DHH keynote
  • How Shopify scales Rails
  • Building Extractable Libraries in Rails
  • Constellation of Architecture
  • Maintainable Templates
  • Monitoring Health of Your App
  • Object oriented in service oriented world
  • Live Streaming Rails