Skip to content

Instantly share code, notes, and snippets.

Nathan Witt wittnl

  • Jellyvision
  • Chicago, IL
Block or report user

Report or block wittnl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wittnl
wittnl / README.md
Last active Oct 12, 2017
Rewind selectors
View README.md

rewindSelector.js

Uses ES2015 Proxy to spy on selector property accesses and returns an object describing the expected state tree

Does not work with IE, even with proxy-polyfill

Usage

Given a set of basic selectors

View camelCasedOneLiner
var camelized = String(inputString).split(/\s+/).reduce(function(p, c, idx) {
return (idx > 0) ? p + c.charAt(0).toUpperCase() + c.slice(1): p + c.charAt(0).toLowerCase() + c.slice(1);
}, '');
View gulp-transform-stream.js
var path = require('path');
var through = require('through2');
var gutil = require('gulp-util');
module.exports = function beautifyData() {
// creating a stream through which each file will pass
var stream = through.obj(function(file, enc, cb) {
View 400Hz-Sample-Data-URIs.md
Waveform specs
Tone frequency 400Hz
Sample rate 8000Hz
Duration 50ms

Hear these samples in action

##WAV## data:audio/wav;base64,UklGRlIBAABXQVZFZm10IBIAAAABAAEAcBcAAHAXAAABAAgAAABkYXRhLAEAAICGjI+QjYqDfXZycHB0eYCGjJCQjYqEfXdzb3F0eYCHjI6Pj4mEfXdycHF0eYCGi4+QjYqEfXZycHF0eYCHi4+QjYqEfXZycHF0eYCHjI+RjoqDfHdycXJ0eYCGjJCRjomDfXZycXF0eoGGjI+QjomDfXdycHF0eoCGjI+QjYqDfXdzcHF0eoCGi4+QjomDfXdycHB0eYCHjI6RjomCfHZycHB0eoCGi4+Qj4mEfHZxb3F0eYCGi4+QjoqDfXdycHJ0eYCGjJCRjoqDfXZycXF0eYCGjI+PjoqDfXdxcHF0eYCHjI+QjomDfHZycHF0eoCHjJCPjoqDfXZycXF1eYCGjI+PjoqEfHZycHF0eYGGi5CRjoqDfHdycHF0eYCGjJCQjYqEfXZycHFzeQ==

@wittnl
wittnl / Audio-Data-URIs.md
Created Aug 12, 2014
Tiny audio data URIs of silence
View Audio-Data-URIs.md

Hear these samples in action (actually, they're all silent)

#WAV# data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA

#MP3# data:audio/mpeg;base64,SUQzAwAAAAAvclRZRVIAAAAGAAAAMjAxNABUREFUAAAABgAAADEyMDgAVElNRQAAAAYAAAAxMTQ5AFBSSVYAAA+4AABYTVAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS41LWMwMTQgNzkuMTUxODA1LCAyMDEzLzA0LzA5LTEyOjA4OjIxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6eG1wRE09Imh0dHA6Ly9ucy5hZG9iZS5jb20veG1wLzEuMC9EeW5hbWljTWVkaWEvIgogICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iCiAgICB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIgogICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVt

@wittnl
wittnl / localStorage.js
Created Jun 7, 2012
localStorage cookies fallback
View localStorage.js
/**
* Adapted from gist by josedaniel
* https://gist.github.com/1001363
*/
if (!window.localStorage){
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
You can’t perform that action at this time.