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
| /** | |
| * Provide support for retina-specific image elements and background styles | |
| * see: http://blog.rjzaworski.com/2012/11/scaling-images-for-retina-displays/ | |
| */ | |
| (function (doc) { | |
| var opts = { | |
| find: /(.+)(\.\w{3,4})$/, | |
| replace: '$12x$2', |
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
| (function (window) { | |
| var app = { | |
| defaults: { | |
| layout: "#layout" | |
| }, | |
| init: function (opts) { | |
| var options = _.extend({}, this.defaults, opts); | |
| var template = $(options.layout).text(); |
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
| // say('hello')('world') & say('hello')('again') | |
| function say (what) { | |
| var words = this instanceof Array ? this : [], | |
| bound = function (what) { return say.call(words, what); } | |
| words.push(what); | |
| bound.toString = function () { console.log(words.join(' ')) }; | |
| return bound; | |
| } |
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
| # `factory` implements test fixtures as object factories. | |
| factory = (fixture) -> | |
| defaults = if _.isFunction(fixture) then fixture() else fixture | |
| (klass, attrs) -> | |
| if _.isFunction(klass) # build it | |
| new klass(_.extend {}, defaults, attrs) | |
| elseif _.isObject(klass) # no klass, just attrs | |
| _.extend {}, defaults, klass | |
| else # | |
| defaults |
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
| 'use strict'; | |
| module.exports = function (grunt) { | |
| // load all grunt tasks | |
| require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
| // set up config | |
| grunt.initConfig({ |
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
| ENV["RAILS_ENV"] = "test" | |
| require File.expand_path('../../config/environment', __FILE__) | |
| require 'rails/test_help' | |
| class ActiveSupport::TestCase | |
| # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. | |
| # | |
| # Note: You'll currently still have to declare fixtures explicitly in integration tests | |
| # -- they do not yet inherit this setting | |
| fixtures :all |
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
| // Concat EJS templates for use in client-side application | |
| // Based on https://gist.github.com/cookrn/3001401 | |
| // | |
| // Supports features found in `_.template()` -- EJS extras not included! | |
| // | |
| var path = require('path'); | |
| module.exports = function (grunt) { | |
| 'use strict'; |
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
| trait Filter { | |
| fn apply(&self, s: &str) -> ~str; | |
| } | |
| struct HelloFilter; | |
| impl Filter for HelloFilter { | |
| fn apply(&self, s: &str) -> ~str { "Hello, " + s } | |
| } |
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
| // Depends on `through` | |
| // | |
| // $ npm install through | |
| // | |
| // Usage: | |
| // | |
| // $ echo 'hello' | node stdin-and-fs-stream.js | |
| // $ echo 'hello' > tmp && node stdin-and-fs-stream.js tmp | |
| // | |
| var fs = require('fs'), |
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
| # Docco must have missed the `0&+` operator... | |
| e = ['truthiness', 'falsitude'][0&+false] | |
| console.log e |