Skip to content

Instantly share code, notes, and snippets.

View fearphage's full-sized avatar
⌨️
Cache rules everything around me.

Phred Lane fearphage

⌨️
Cache rules everything around me.
View GitHub Profile
@fearphage
fearphage / gist:1374576
Created November 17, 2011 21:21
Trying to purchase from the android market
xpc: Sent data to checkout.restxpc.slave.handle
xpc: Sent data to checkout.restxpc.master.handle
xpc: Attempting to establish channel
Thu Nov 17 15:18:48 GMT-600 2011 CrossDomainLogger
WARNING: {"duration":{"name":"total", "start":134685, "end":136258, "childSegments":[{"name":"ServerCall", "start":134685, "end":135365, "childSegments":[]}]}, "name":"PurchaseFlowCreate"}
Page Loaded!
INFO: Injected script get command 'fvd_get_videos'
INFO: Injected script get command 'fvd_get_videos'
INFO: Injected script get command 'fvd_get_videos'
INFO: Injected script get command 'fvd_get_videos'
@fearphage
fearphage / 01-before.js
Created February 18, 2012 03:19 — forked from insin/01-before.js
Before and after caolan/async (not tested yet!)
// $r = redis client
// $f = util.format
function createUser(username, email, password, cb) {
$r.incr('users.count', function(err, id) {
if (err) return cb(err)
$r.set($f('username.to.id:%s', username.toLowerCase()), id, function(err) {
if (err) return cb(err)
var user = {id: id, username: username, email: email}
getRandom(function(err, salt) {
@fearphage
fearphage / gist:1902781
Created February 24, 2012 18:27
Revert Backbone 0.9.1 from optimistic to realistic (read: classic) functionality
(function(CollectionPrototype, ModelPrototype, slice) {
var monkeyPatch = function(prototype, name) {
var method = prototype[name];
prototype[name] = function() {
var
args = slice.call(arguments)
,length = args.length
,options = length && length >= method.length && args[args.length - 1]
;
@fearphage
fearphage / gist:2630780
Created May 7, 2012 22:01
Screenshot selection to Dropbox and copy URL
#!/bin/bash
# Settings
url=http://dl.dropbox.com/u/2400/scrot
dir=~/Dropbox/Public/scrot
filename=selection_$(date +%Y-%m-%d_%H%M%S).png
# End Settings
scrot -s "$dir/$filename"
@fearphage
fearphage / octocat.svg
Created May 18, 2012 07:02 — forked from johan/octocat.svg
Github octocat avatar, SVG format
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
var ViewFactory = (function() {
function ViewFactory(pubSub) {
this.pubSub = pubSub;
this.registry = {};
this.registry['factory'] = this;
}
ViewFactory.prototype.register = function(key, value) {
return this.registry[key] = value;
@fearphage
fearphage / data.json
Created September 13, 2012 16:53
doT.js template example
{
"settings": {
"foo": "low"
,"bar": "high"
,"baz": "low"
}
}
@fearphage
fearphage / README.md
Created September 19, 2012 23:47 — forked from melanke/README.md
JQuery RedditLoader - smart and customizable reddit content loader

JQuery RedditLoader 2.1.0 Download

About

Load images, Imgur Albuns, Youtube videos, and Articles (beta) of Reddit links, loading only when the previous content was loaded

###Livedemo http://redditmobile.blogspot.com.br

###Dependencies

  • JQuery
@fearphage
fearphage / README.md
Created September 20, 2012 14:45
Can you make this faster?

The goal is to add N new elements to the DOM as quickly and as painlessly as possible.

I have access to jQuery and found the code below to be faster than the following:

$(parentElement)
  .append(Array(1001).join(template))
;
@fearphage
fearphage / mp3player.js
Created October 24, 2012 20:39 — forked from TooTallNate/mp3player.js
node.js command line MP3 player in 9 lines of code!
var fs = require('fs');
var lame = require('lame');
var Speaker = require('speaker');
fs.createReadStream(process.argv[2])
.pipe(new lame.Decoder())
.on('format', function (format) {
this.pipe(new Speaker(format));
});