Skip to content

Instantly share code, notes, and snippets.

View JonAbrams's full-sized avatar

Jon Abrams JonAbrams

View GitHub Profile
@JonAbrams
JonAbrams / gist:926fc687b5f1658854dc
Created May 16, 2014 21:21
Stub out a JSON API response using Synth
exports.getIndex = function (req, res) {
return [
{
title: "Duck Game",
developer: "Landon Podbielski",
tile_image: "https://www.ouya.tv/gamehub/listimgs/6d547a77-1a81-403c-8065-0cea25c5d81c.jpg"
},
{
title: "TowerFall",
developer: "Matt Makes Gamers Inc.",
@JonAbrams
JonAbrams / .gitignore
Last active August 29, 2015 14:01
Getting a Synth app running on heroku
node_modules
@JonAbrams
JonAbrams / gist:9165022
Created February 23, 2014 00:56
Example one-line if statement
if (age >= 21)
giveBeer()
@JonAbrams
JonAbrams / gFind.js
Last active December 22, 2015 18:59
Find, in memory, a particular string.
function gFind(pattern) {
var path = [];
var isObject = function (obj) {
return (/^(Object|Array|String)/).test(obj.constructor.name);
};
(function gFindRec(obj) {
var found;
javascript:location.href="googlechrome://"+location.hostname+location.pathname+location.search;
window.onpopstate = function (event) {
if (event.state == null) {
return;
}
old_text.val(event.state.old_text);
new_text.val(event.state.new_text);
};
$(document).ready(function () {
if (typeof(history.replaceState) !== "undefined") {
history.replaceState({
old_text: old_text.val(),
new_text: new_text.val(),
slug: location.pathname.replace("/", "")
}, null, null);
}
});
if (typeof history.pushState === "undefined") {
// Refresh the page to the new URL if pushState not supported
location.href = new_path
}
history.pushState({
old_text: old_text.val(),
new_text: new_text.val(),
slug: new_path
}, null, new_path);
history.pushState( {
old_text: old_text.val(),
new_text: new_text.val(),
slug: new_path
}, null, new_path);