Skip to content

Instantly share code, notes, and snippets.

View furf's full-sized avatar
🎯
Focusing

Dave Furfero furf

🎯
Focusing
View GitHub Profile
{
"lambda": {
"envVars": [],
"deploy": false,
"package": {
"optimize": {
"builder": "browserify",
"minify": true,
"ignore": [],
"exclude": [
@furf
furf / helpers.js
Created September 18, 2015 23:00
the hilarity of { "padded-blocks": [2, "always"] }
export function get(url, callback) {
return function handleGet(next) {
const request = require('request');
request(url, function handleRequest(error, response, body) {
if (error) {
@furf
furf / regex.js
Created September 9, 2015 22:32
Implement basic regex.
function regex(p, s) {
var pPointer = 0;
var pLength = p.length;
var pChar = '';
var sPointer = 0;
var sLength = s.length;
var sChar = '';
var wChar = '';
@furf
furf / sample.styl
Created March 12, 2015 17:40
stylus wins.
@import '_common'
/**
* Clock animation
*/
@keyframes alarm
from
transform rotate(-10deg)
to
@furf
furf / base.js
Created March 12, 2015 16:11
Yet another prototypal inheritance scheme.
/**
* Base inheritable/mixable object with `create` and `mixin` functionality.
* @type {Object}
*/
var Base = {
/**
* Create a new instance of the object and mixin additional behaviors.
@furf
furf / fizzbuzz-precompute.js
Last active August 29, 2015 14:15
fizzbuzz
function fizzbuzz(n, s, i) {
s = {
0: 'FizzBuzz',
3: 'Fizz',
5: 'Buzz',
6: 'Fizz',
9: 'Fizz',
10: 'Buzz',
12: 'Fizz'
};
@furf
furf / cardFactory.html
Last active August 29, 2015 14:11
Prototypal factory
<!DOCTYPE html>
<html>
<head>
<title>CardFactory</title>
</head>
<body>
<script src="http://code.jquery.com/jquery.js"></script>
<script>
;(function(window, document, $) {
@furf
furf / jsdoc-tdd.js
Created July 25, 2014 20:54
Wouldn't it be nice...
/**
* Adds two numbers.
* @param {Number} a First addend.
* @param {Number} b Second addend.
* @return {Number} The sum of the addends.
* @when a is 1 and b is 2
* @expect 3
*/
function addition(a, b) {
return a + b;
@furf
furf / findLongSelectors.js
Last active August 29, 2015 14:04
Find CSS selectors greater than n
function findLongSelectors(n) {
var sheets = document.styleSheets;
var splitRule = /\s*,\s*/;
var splitWhitespace = /\s+/;
var longRules = [];
[].forEach.call(document.styleSheets, function(styleSheet) {
if (!styleSheet.cssRules) return;
[].forEach.call(styleSheet.cssRules, function(cssRule) {
@furf
furf / array-to-range.js
Last active August 29, 2015 14:01
convert an array to a range, sorta.
// https://twitter.com/angustweets/status/467117418511212544
var a = [1,2,3,4,5];
a.map(Date.call, Number); // [0, 1, 2, 3, 4]
var b = []; b.length = 5;
b.map(Date.call, Number); // [undefined × 5]
var c = [,,,,,]
c.map(Date.call, Number); // [undefined × 5]