I hereby claim:
- I am weisjohn on github.
- I am weisjohn (https://keybase.io/weisjohn) on keybase.
- I have a public key whose fingerprint is 1499 7B49 6AD9 35B2 AF3D 2780 A5B1 A295 C05D CF30
To claim this, I am signing this object:
$ phantomjs | |
phantomjs> a = '[{"foo":"bar"},{"foo":"cat"}]' | |
"[{\"foo\":\"bar\"},{\"foo\":\"cat\"}]" | |
phantomjs> JSON.parse(a) | |
{ | |
"0": { | |
"foo": "bar" | |
}, | |
"1": { |
I hereby claim:
To claim this, I am signing this object:
function get(url, cb) { | |
// use jQuery if you can, if not, XHR, or try to node | |
if (typeof $ !== "undefined" && !!$().jquery) { | |
$.ajax(url).then(function(data) { | |
cb(null, data); | |
}, function(j, t, e) { | |
cb(e); | |
}); | |
} else if (typeof XMLHttpRequest !== "undefined") { | |
// simple XHR attempt |
A wonderfully warm winter day. Everything was perfect. Lofty visions of CSS3 animations dazzled my eyes. Nay, what's this? A browser from years ago appears. What's that you say? It doesn't support keyframes? Ghast. Make an animated gif! Oh, wait, we need transparency? Make an animated png!
This is the final outcome (sans history) of half a day spent to ensure experience parity on a super old (Opera 9.8) browser that we absolutely have to support.
It took hours, and it wasn't probably worth it, but I learned so much, and in the end it works pretty well.
### | |
#Step 1 - Generate server certificates etc... (most of this code is horribly ripped off from nodejs docs currently -> http://nodejs.org/docs/latest/api/tls.html) | |
### | |
#Assuming your starting from a clean directory | |
mkdir server | |
cd server | |
#generate private key |
var chirp = require('twitter') | |
, _ = require('lodash') // cause underscore is so 2009.. | |
; | |
module.exports = function(app) { | |
// bro shortcuts for getting the tweets | |
app.get('/mah/chirps', function(req, res) { | |
// closures, like a pro javascript dude | |
function hollaback(fail, party) { |
// this code isn't intended to work: | |
if (J.body) { | |
a = aa(a); | |
try { | |
var c = J[qa]('<iframe name="' + a + '"></iframe>') | |
} catch (d) { | |
c = J[qa]("iframe"), ha(c, a) | |
} | |
c.height = "0"; |
#!/bin/bash | |
# rotates logs for all services on this box | |
# the services for which we should rotate logs | |
SERVICE_DIR=~/mysrc | |
services=$(ls $SERVICE_DIR) | |
function rotate { | |
logfile=$SERVICE_DIR/$1/logs/$2.log |
javascript:document.write('<!DOCTYPE html><html><head><meta charset="utf-8"><title>Responsive Design Testing</title><style>body %7B margin: 20px; font-family: sans-serif; overflow-x: scroll; %7D.wrapper %7B width: 6000px; %7D.frame %7B float: left; %7Dh2 %7B margin: 0 0 5px 0; %7Diframe %7B margin: 0 20px 20px 0; border: 1px solid %23666; %7D</style></head><body><div class="wrapper"><div class="frame"><h2>240<span> x 320</span> <small>(mobile)</small></h2><iframe src="' + window.location + '" sandbox="allow-same-origin allow-forms" seamless width="240" height="320"></iframe></div><div class="frame"><h2>320<span> x 480</span> <small>(mobile)</small></h2><iframe src="' + window.location + '" sandbox="allow-same-origin allow-forms" seamless width="320" height="480"></iframe></div><div class="frame"><h2>480<span> x 640</span> <small>(small tablet)</small></h2><iframe src="' + window.location + '" sandbox="allow-same-origin allow-forms" seamless width="480" height="640"></iframe></div><div class="frame"><h2>768<sp |
// how long should we wait for a function to fire? | |
var delay = 0; | |
// a simple way to wrap functions to be delayed | |
function postponed(fn) { | |
return function() { | |
setTimeout(fn, delay); | |
} | |
} |