I hereby claim:
- I am matthewhudson on github.
- I am matthewhudson (https://keybase.io/matthewhudson) on keybase.
- I have a public key whose fingerprint is 7B45 9A21 41FC FCD3 46EF B079 43BE B01D 5135 4390
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Note that when compiling with coffeescript, the plugin is wrapped in another | |
# anonymous function. We do not need to pass in undefined as well, since | |
# coffeescript uses (void 0) instead. | |
do ($ = jQuery, window, document) -> | |
# window and document are passed through as local variable rather than global | |
# as this (slightly) quickens the resolution process and can be more efficiently | |
# minified (especially when both are regularly referenced in your plugin). | |
# Create the defaults once |
crypto = require 'crypto' | |
key = 'monkeybutt' | |
cipher = crypto.createCipher 'aes128', key | |
decipher = crypto.createDecipher 'aes128', key | |
encrypt = (plaintext) -> | |
encrypted = cipher.update plaintext, 'utf8', 'base64' | |
encrypted += cipher.final 'base64' |
During discussions of syncing, the chance that someone will mention #git approach 1 |
# Parse bitcoin URL query keys. | |
parseBitcoinURL = (url) -> | |
r = /^bitcoin:([a-zA-Z0-9]{27,34})(?:\?(.*))?$/ | |
match = r.exec(url) | |
return null unless match | |
parsed = url: url | |
if match[2] | |
queries = match[2].split("&") | |
i = 0 |
/* Parse bitcoin URL query keys. */ | |
function parseBitcoinURL(url) { | |
var r = /^bitcoin:([a-zA-Z0-9]{27,34})(?:\?(.*))?$/; | |
var match = r.exec(url); | |
if (!match) return null; | |
var parsed = { url: url } | |
if (match[2]) { | |
var queries = match[2].split('&'); |
# Simple in-memory caching. Defaults to 2s | |
# http://jsperf.com/date-now-vs-new-date-gettime/4 | |
store = {} | |
cache = {} | |
cache.set = (key, value, milliseconds) -> | |
if not store[key]? | |
store[key] = value |
# Sends anything from request back as JSON | |
exports.pong = (req, res) -> | |
# Create ping-pong response from received data | |
data = | |
pongQuery: req.query | |
pongBody: req.body | |
pongParams: req.params | |
pongCookies: req.cookies | |
id: req.params.id | |
controller: req.params.controller |
clone = (obj) -> | |
return obj if not obj? or typeof (obj) isnt "object" | |
tmp = obj.constructor() | |
for key of obj | |
tmp[key] = clone(obj[key]) | |
tmp |
var ParentView = Backbone.View.extend({ | |
'events': { | |
'click .parent-something': "onParentSomethingClick" | |
} | |
}); | |
var ChildView = ParentView.extend({ | |
'events': _.extend({ | |
'click .something': 'onSomethingClick', | |
}, ParentView.prototype.events) |