Skip to content

Instantly share code, notes, and snippets.

View designfrontier's full-sized avatar

Daniel Sellers designfrontier

View GitHub Profile
writeln("setting up server...")
server := HttpServer clone do(
setPort(8090)
renderResponse := method(request, response,
list("path", "uri", "body") foreach(k,
v := request perform(k)
response body appendSeq(k .. ": " .. v .. "<br>")
)
const ajax = require('utils/ajax');
const Promise = require('Promise');
/*
* The queue itself...
*
* @param {String} retryConut The number of times that it should retry a request
* before it gives up and rejects it.
*
* @return {object}
@designfrontier
designfrontier / queue.js
Last active May 12, 2016 15:57
pseudo-ish code change queue
const saveQueue = [
slide,
slide1,
slide2,
slide
];
const attemptedSlides = {};
const running = false;
@designfrontier
designfrontier / getCurrentBG.js
Last active January 12, 2016 17:17
get Background color
getComputedBG = function (elem) {
var rtn = window.getComputedStyle(elem)['background-color'],
element = elem,
isTransparent = function (color) {
return color === 'rgba(0, 0, 0, 0)' || color === 'transparent'
};
while (element !== null && isClear(rtn)) {
element = element.parentElement;
rtn = window.getComputedStyle(element)['background-color'];
@designfrontier
designfrontier / app.js
Created December 1, 2015 18:59
return a 500 error for all requests
var http = require('http');
var server = http.createServer(function (req, res) {
console.log(req.url);
if (req.url !== '/api/presence' && req.url !== '/api/heartbeat') {
res.statusCode = 500;
res.end('error');
} else {
res.end('works');
}
@designfrontier
designfrontier / post-checkout
Last active November 26, 2015 00:06
post-commit hook for clearing node_modules
#!/bin/sh
rm -rf node_modules/
npm install
@designfrontier
designfrontier / spin.js
Last active October 10, 2015 02:24
node console spinner (rough)
var arr = [
'\\',
'|',
'/',
'-',
]
, position = 0;
arr = arr.concat(arr, arr, arr, arr, arr, arr);
@designfrontier
designfrontier / lone-star.zsh-theme
Last active September 20, 2016 12:22
Lone Star zsh
#!/usr/bin/env zsh
# ------------------------------------------------------------------------------
#
# Lone Star - A futuristic minimal awesome Texas inspired theme for zsh
#
# Based heavily on the pure theme which includes the following note:
#
# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge
# thanks goes out to him for designing the fantastic Pure prompt in the first
@designfrontier
designfrontier / gist:fb95b0a212f55554a09b
Last active August 29, 2015 14:25
bernstein real world-ish with pseudo code
var userCreationStack = bernstein.create([
function (data, orig, next){
var imageProm = imageServiceWrapper.sliceAndDice(data.image);
imageProm.then(function (imageData) {
data.images = imageData;
next(data);
});
}
@designfrontier
designfrontier / gist:6b3c11ff4c0382f702e1
Last active August 29, 2015 14:25
bernstein in use
var funcArray = [function(data, orig, next){
data.num++;
next(data);
}
, function(data, orig, next){
data.num++;
next(data);
}
, function(data, orig, next){
data.num++;