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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script> | |
<script src="http://documentcloud.github.io/underscore/underscore-min.js"></script> | |
<script src="http://documentcloud.github.io/backbone/backbone-min.js"></script> |
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 pattern to generate both migration file and copy | |
# other files | |
require 'rails/generators' | |
require 'rails/generators/migration' | |
require 'rails/generators/active_record' | |
class FooGemGenerator < Rails::Generators::Base | |
include Rails::Generators::Migration |
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
# Raw Javascript functions | |
window.parseQueryString = -> | |
query = (window.location.search || '?').substr(1) | |
map = {} | |
query.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g, (match, key, value) -> | |
(map[key] = map[key] || []).push(value) | |
) | |
return map |
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
// Iterates an one level object with functions inside and return invoked values | |
// This was an unmerged PR by me https://github.com/jashkenas/underscore/pull/1482 | |
// Patch it in a Backbone project when needed. | |
_.results = function(object, context) { | |
if (typeof context == "undefined") { | |
context = object; | |
}; | |
var copy = {}; | |
_.each(object, function(value, key) { | |
var v = _.isFunction(value) ? value.call(context) : 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
module.exports = function (grunt) { | |
// show elapsed time at the end | |
require('time-grunt')(grunt); | |
// load all grunt tasks | |
require('load-grunt-tasks')(grunt); | |
//MODIFIED: add require for connect-modewrite | |
var modRewrite = require('connect-modrewrite'); | |
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
// USAGE ------ | |
// ============ | |
var shell = require('./shellHelper'); | |
// execute a single shell command | |
shell.exec('npm test --coverage', function(err){ | |
console.log('executed test'); | |
}}); |
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 APIWrapper: | |
#snippet... | |
def poll_api(self, tries, initial_delay, delay, backoff, success_list, apifunction, *args): | |
time.sleep(initial_delay) | |
for n in range(tries): | |
try: | |
status = self.get_status() | |
if status not in success_list: |