Skip to content

Instantly share code, notes, and snippets.

View designfrontier's full-sized avatar

Daniel Sellers designfrontier

View GitHub Profile
@designfrontier
designfrontier / foresight.sh
Last active January 31, 2017 17:04
foresight: A way to find major owners of files you have changed in your commit
#!/usr/bin/env bash
set -e
function ADD_AUTHOR {
local author_to_add=$1
if ! [ -z "${author_to_add}" ]; then
#add something to add people to review in your source repo
fi
// abs.js
const FILES = require('fs');
module.exports = {
absorb: (htmlPath) => {
let html = FILES.readFileSync(htmlPath, 'utf8');
html = html.replace(/(<absorb\s(.+)\/>)/g, function(absorbElement) {
let filePath = '', fileType = '', jsMod = '';
if (absorbElement.indexOf('css=') >= 0) {
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