Skip to content

Instantly share code, notes, and snippets.

@jonleung
jonleung / HerokuPoke.sh
Created September 26, 2011 10:26
HerokuPoke
count_sheep () {
COUNTER=100
while [ $COUNTER -gt 0 ]; do
echo $COUNTER
sleep 1
let COUNTER=COUNTER-1
done
}
function poke {
@jonleung
jonleung / lc4_decode.rb
Created April 19, 2012 07:40
Decode LC4 instructions
file = File.new(ARGV[0], "r")
imem_out_regex = /(^.*?)imem_out: (\d+)$/
def replace(insn, r)
if insn == "0000"
(r == "000000000000") ? "NOP" : "BRANCH #{r[0..3]} #{r[4..15]}" + "\t\t\t #{insn} #{r}"
elsif insn == "0001"
"ARITH d=#{r[0..2]} s=#{r[3..5]} kind=#{r[6..8]} t=#{r[9..12]}" + "\t\t\t #{insn} #{r}"
elsif insn == "0010"
@jonleung
jonleung / cross_domain.js
Created June 19, 2012 14:53
Cross Domain Access in Javascript
function filterData(data){
// data = data.replace(/<?\/body[^>]*>/g,'');
// data = data.replace(/[\r|\n]+/g,'');
// data = data.replace(/<--[\S\s]*?-->/g,'');
// data = data.replace(/<noscript[^>]*>[\S\s]*?<\/noscript>/g,'');
// data = data.replace(/<script[^>]*>[\S\s]*?<\/script>/g,'');
// data = data.replace(/<script.*\/>/,'');
// data = data.replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
data = data.replace(/<style[^>]+?\/>|<style(.|\s)*?\/style>/gi, '')
@jonleung
jonleung / iterm.sh
Created July 3, 2012 23:56
Resuming SSH + Screen sessions in iTerm
#Don't forget to do a 'chmod +x iterm.sh'
#Also, obviously I don't really know how to use AppleScript so this is really really crappy AppleScript code lol...
osascript <<ENDSCRIPT
tell application "iTerm"
activate
--terminate the first session of the first terminal
@jonleung
jonleung / .sh
Created July 8, 2012 19:35
Extract Wunderlist DB
cd ~/Library/Wunderlist; sqlite3 -csv -header wunderlist.db "select * from tasks left join lists on tasks.list_id=lists.id;" > wunderlist_export.csv
@jonleung
jonleung / drill.md
Created October 4, 2013 01:12 — forked from phlco/drill.md

Emergency WDI Pick me up

Prompt

For today's drill, we're going to be creating a site like Emergency Compliment, except it will be WDI themed.

When a user visits the site, they'll be greeted with a WDI pick me up that will hopefully cheer them up.

Create a basic Sinatra app inside your drills folder called pick_me_up Create your main.rb file and a views folder. In your views folder, you'll have a layout.erb file and a compliment.erb file.

@jonleung
jonleung / gist:7208522
Created October 29, 2013 02:57
Javascript Template
index.html
[![image](http://i.imgur.com/33FCJEi.png)](https://github.com/jonleung/passage-through-hades/issues/new) &nbsp;&nbsp; ![image](http://i.imgur.com/S07f7KC.png) &nbsp;&nbsp;&nbsp;<iframe src="https://ghbtns.com/github-btn.html?user=jonleung&repo=passage-through-hades&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="158px" height="30px"></iframe>
# Twilio II
**Github**: `https://github.com/jonleung/passage-through-hades`
**Name**: Passage Through Hades
**Activity Type**: Timed Challenege

Zinder

The Greek God Zeus is starting an online dating servce called Zinder. Zinder lets any users signup for a potential date with Zeus, and only zeus.

Zinder's Tagline: "Why date anyone else when you can date Zeus?"™.

We have all been hired as Zinder's first employees.

Setup