Skip to content

Instantly share code, notes, and snippets.

View novwhisky's full-sized avatar

Nathan Witt novwhisky

View GitHub Profile
@novwhisky
novwhisky / README.md
Last active October 12, 2017 20:56
Rewind selectors

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

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);
}, '');
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) {
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==

@novwhisky
novwhisky / Audio-Data-URIs.md
Last active August 4, 2024 17:00
Tiny audio data URIs of silence

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

WAV

data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA

MP3

data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAAAwAAAbAAqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV////////////////////////////////////////////AAAAAExhdmM1OC4xMwAAAAAAAAAAAAAAACQDkAAAAAAAAAGw9wrNaQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+MYxAAAAANIAAAAAExBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDsAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxHYAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

OGG

data:audio/ogg;base64,T2dnUwACAAAAAAAAAAAyzN3NAAAAAGFf2X8BM39GTEFDAQAAAWZMYUMAAAAiEgASAAAAAAAkFQrEQPAAAAAAAAAAAAAAAAAAAAAAAAAAAE9nZ1MAAAAAAAAAA

@novwhisky
novwhisky / localStorage.js
Created June 7, 2012 19:05
localStorage cookies fallback
/**
* 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();