Skip to content

Instantly share code, notes, and snippets.

@cheapsteak
cheapsteak / gist:5205777
Last active December 15, 2015 04:59 — forked from radiosilence/gist:4040553
Zurb Foundation 4 Shim for RequireJS.
/**
* You might want to change baseUrl to something else depending on where your require.js is.
* If you want to do conditional loading of Zepto, take a look at the discussion at
* https://groups.google.com/forum/?fromgroups=#!topic/requirejs/68oIXcyou48
* Had to add explicit paths for each plugin, otherwise `require` tries to look for it in
* /foundation/foundation/foundation.alerts.js
*/
require.config({
baseUrl: "js",
@cheapsteak
cheapsteak / gist:5874339
Last active December 19, 2015 01:18
For fun
/**
* A shamefully unintuitive/unreadable/unmaintainable but fun solution to this problem...or is it?
* http://stackoverflow.com/questions/17334688/how-can-i-abstract-generalize-functions-that-perform-similar-but-just-slightly/17335053?noredirect=1#17335053
*/
json = [
{target: '.FFEC-Display', title : 'h3', actions : [{action: 'find', target: '.movie-link'}, 'prepend']},
{target: '.MovieItemsRotator .item', title: '.Title', actions: ['prepend']}
];
@cheapsteak
cheapsteak / helper.md
Last active August 29, 2015 14:02
Turning a normal array into an associative array using aribitrary property

Given

var countries = [
  {
    country: "Canada",
    capital: {
      name: "Ottawa",
      population: 883391
    }
 },
@cheapsteak
cheapsteak / 0_reuse_code.js
Created July 8, 2014 21:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cheapsteak
cheapsteak / snippet.js
Created July 8, 2014 21:52
Get Google Form field names
var fields = {};
[].slice.call($$('input[id^="entry_"]')).forEach(function (el) {
var name = el.getAttribute('name');
var label = el.getAttribute('aria-label').trim();
fields[label] = name;
});
console.log(JSON.stringify(fields));
// ==UserScript==
// @name Monster Minigame Auto-script
// @namespace https://github.com/wchill/steamSummerMinigame
// @description A script that runs the Steam Monster Minigame for you. Modified from mouseas's original version to include autoclick.
// @version 1.0
// @match http://steamcommunity.com/minigame/towerattack*
// @updateURL https://raw.githubusercontent.com/wchill/steamSummerMinigame/master/autoPlay.js
// @downloadURL https://raw.githubusercontent.com/wchill/steamSummerMinigame/master/autoPlay.js
// ==/UserScript==
@cheapsteak
cheapsteak / index.js
Created July 7, 2015 14:57
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var RouteRecognizer = require('route-recognizer');
var router = new RouteRecognizer();
var handler = function () {
};
import exec from 'promised-exec';
import chalk from 'chalk';
import {argv} from 'yargs';
import rimraf from 'rimraf';
import buildConfig from './build-config.js';
const error = chalk.red;
const ok = chalk.green;
const yellow = chalk.yellow;
@cheapsteak
cheapsteak / workflow.md
Last active August 29, 2015 14:25
Workflow with Dploy.io (now DeployBot)

DeployBot:

  • Allows anyone to deploy without giving them server credentials
  • Ease of rollbacks
    image

Method 1: Check in compiled code

  1. Make sure working directory is clean (all changes committed or stashed)
  2. Checkout deploy/(dev|qa|staging|production)
  3. Pull origin
  4. Merge from previous branch

Swagger RESTful API Documentation Specification

Version 2.0

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

The Swagger specification is licensed under The Apache License, Version 2.0.

Introduction