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
// Easily find all labels, or a filtered set of labels for the element | |
;(function($) { | |
$.fn.findLabels = function(filterSelector) { | |
filterSelector = filterSelector || ''; | |
return $(document).find('label[for="'+this[0].id+'"]'+filterSelector); | |
}; | |
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
var fs = require('fs'); | |
var spawn = require('child_process').spawn; | |
var summary = []; | |
var errors = []; | |
var app = { | |
toProcess: 0,, | |
processed: 0, | |
readdir: function(err, files) { |
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
if ( ! Modernizr.placeholder ) { | |
(function($) { | |
$(document).find('input[placeholder]').each(function() { | |
var el = $(this).on('keyup blur change', function() { | |
placeholder[this.value.length > 0 ? 'hide' : 'show'](); | |
}); | |
var css = {}; | |
var offset = el.position(); | |
css.left = offset.left + parseFloat(el.css('padding-left')) + parseFloat(el.css('margin-left')); | |
css.top = offset.top + parseFloat(el.css('padding-top')) + parseFloat(el.css('margin-top')); |
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
// jquery.event.press | |
(function($, Modernizr) { | |
"use strict"; | |
var touchEnabled = Modernizr && Modernizr.touch; | |
if ( touchEnabled ) { | |
// Lift touch properties using fixHooks, inspired by jquery.panzoom, with checks | |
var touchHook = { props: [ "touches", "targetTouches", "changedTouches", "pageX", "pageY" ] }; | |
$.each([ "touchstart", "touchmove", "touchend" ], function( i, name ) { | |
var existingHook = $.event.fixHooks[ name ]; | |
if ( ! existingHook ) { |
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
// jquery.teletype | |
// depends on lettering.js | |
(function($) { | |
var Teletype = function(el, options) { | |
this.el = el; | |
this.opts = $.extend({}, $.fn.teletype.defaults, options); | |
this.containers = $(el).find(this.opts.selector); | |
this.init(); |
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
// Uses passport-bitbucket | |
var strategy = new BitbucketStrategy({ | |
consumerKey: BITBUCKET_CONSUMER_KEY, | |
consumerSecret: BITBUCKET_CONSUMER_SECRET, | |
callbackURL: "http://127.0.0.1:3000/auth/bitbucket/callback" | |
}, | |
function(token, tokenSecret, profile, done) { | |
// asynchronous verification, for effect... | |
process.nextTick(function () { | |
api.setTokens(token, tokenSecret); |
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
// flexbox | |
.flex-display(@inline:false) { | |
@box-display: ~`"@{inline}" === 'inline' ? 'box-inline' : 'box'`; | |
@flex-display: ~`"@{inline}" === 'inline' ? 'inline-flex' : 'flex'`; | |
display: ~"-webkit-@{box-display}"; | |
display: ~"-moz-@{box-display}"; | |
display: ~"-ms-@{flex-display}box"; | |
display: ~"-webkit-@{flex-display}"; |
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
grunt.initConfig({ | |
concat: { | |
options: { | |
process: function(src, filepath) { | |
var matches = src.match(/require\(["'].*?['"]\);?/g); | |
if ( matches ) { | |
matches.forEach(function(match) { | |
var path = filepath.substr(0, filepath.lastIndexOf('/') + 1) + match.match(/["'](.*?)['"]/)[1]; | |
var fileSrc = grunt.file.read(path); | |
src = src.replace(match, '// Source: ' + path + '\n' + fileSrc); |
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
// jquery.localCompress | |
// get, set return promises | |
(function($, localStorage) { | |
$.localCompress = function(workerURL) { | |
var initWorker = function(onmessage, type, value) { | |
var worker = new Worker(workerURL); | |
worker.onmessage = onmessage; | |
worker.postMessage({ |
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
// Using lodash so we can use isPlainObject | |
var | |
_ = require('lodash'), | |
Marionette = require('backbone.marionette'); | |
var _constructor = Marionette.View.prototype.constructor; | |
Marionette.View = Marionette.View.extend({ | |
constructor: function (attributes, options) { | |
var self = this; |
OlderNewer