This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simulate onhashchange support in all browsers | |
"onhashchange" in window || (function () { | |
var lastHash = ''; | |
function pollHash() { | |
if (lastHash !== location.hash) { | |
lastHash = location.hash; | |
var event = document.createEvent("HTMLEvents"); | |
event.initEvent("hashchange", true, false); | |
document.body.dispatchEvent(event); | |
if (typeof onhashchange == "function") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>swarm!</title> | |
<script type="text/javascript" language=JavaScript src="buzzWorker.js"></script> | |
<style> | |
.thing { | |
position:absolute; | |
} | |
.dying { | |
color:#ff0000; | |
font-weight:bold; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from BeautifulSoup import BeautifulSoup, NavigableString | |
from waveapi import element | |
import re | |
import htmlentitydefs | |
IMAGE_PLACEHOLDER = '***{{((IMAGE_ELEMENT))}}***' | |
def append_content_to_blip(blip, content, type=None): | |
if type == 'text/plain': | |
# Replace characters that Wave breaks on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
// one way | |
foo ? bar.doSomething(el) : bar.doSomethingElse(el); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Classy - Simple and Fast Javascript Inheritance. | |
(No fancy stuff) | |
Inspiration: | |
http://ejohn.org/blog/simple-javascript-inheritance/ | |
http://valums.com/javascript-oop/ | |
http://www.broofa.com/blog/2009/02/javascript-inheritance-performance/ | |
Example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Access Code Generator & Validator | |
// API: | |
// string generateAccessCode() | |
// Boolean validateAccessCode(codeString) | |
(function () { | |
// configure: | |
var difference = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Shape Maker</title> | |
<style type="text/css"> | |
body { | |
font-family: Helvetica, Arial, sans-serif; | |
line-height: 1.5em; | |
font-size: 14px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
server='127.0.0.1' | |
log='irclogs/*/*.log' | |
ssh "$server" "tail -n1 -f $log" | sed -l 's/^[^ ]* < //' | while read line; do | |
sender="${line%>*}" | |
msg="${line#*> }" | |
growlnotify -m "$msg" "$sender" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git.sh - Interactive Git Shell | |
# store command history here | |
HISTFILE=~/.gitsh_history | |
control_c() { | |
# save history before exiting | |
history -a | |
# i can't figure out how to make this just break out of the read command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env coffee | |
# put this file in the same dir as namecoind executable | |
child_process = require 'child_process' | |
child_process.exec './namecoind name_list', (err, stdout, stderr) -> | |
(JSON.parse stdout).forEach (domain) -> | |
if domain.expires_in < 5000 | |
command = "./namecoind name_update #{JSON.stringify domain.name} #{JSON.stringify domain.value}" |
OlderNewer