This file contains hidden or 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
<div class="container-outer"> | |
<div class="container-middle"> | |
<div class="container-inner"> | |
<p>Hello World!</p> | |
</div> | |
</div> | |
</div> |
This file contains hidden or 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
class GUID | |
s4: -> | |
Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1) | |
create: () -> | |
"#{@s4()}#{@s4()}-#{@s4()}-#{@s4()}-#{@s4()}-#{@s4()}#{@s4()}#{@s4()}" | |
guid = new GUID | |
console.log guid.create() |
This file contains hidden or 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
<style>.wf-loading{visibility:hidden}</style> | |
<script type="text/javascript"> | |
(function (doc) { | |
var config = { | |
kitId: 'abc1def', | |
scriptTimeout: 3000 | |
}; | |
var getElement = function (tagName) { |
This file contains hidden or 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
var BaseView = Backbone.View.extend({ | |
el: $('body'), | |
initialize: function() { | |
// bind to the namespaced (for easier unbinding) event | |
// in jQuery 1.7+ use .on(...) | |
$(window).bind("resize.app", _.bind(this.resize, this)); | |
}, |
This file contains hidden or 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
var ParentView = Backbone.View.extend({ | |
'events': { | |
'click .parent-something': "onParentSomethingClick" | |
} | |
}); | |
var ChildView = ParentView.extend({ | |
'events': _.extend({ | |
'click .something': 'onSomethingClick', | |
}, ParentView.prototype.events) |
This file contains hidden or 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
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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
/* 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('&'); |
This file contains hidden or 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
# 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 |