Skip to content

Instantly share code, notes, and snippets.

💭
this is dumb

Kevin Ennis kevincennis

💭
this is dumb
Block or report user

Report or block kevincennis

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
@kevincennis
kevincennis / v8.md
Last active Feb 12, 2020
V8 Installation and d8 shell usage
View v8.md

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.bash_profile
    • Add export PATH=/path/to/depot_tools:"$PATH" (it's important that depot_tools comes first here)
@kevincennis
kevincennis / pluck.js
Last active Dec 6, 2019
Karplus-Strong with Web Audio API
View pluck.js
function Pluck( ctx ) {
this.sr = ctx.sampleRate;
this.pro = ctx.createScriptProcessor( 512, 0, 1 );
this.pro.connect( ctx.destination );
}
Pluck.prototype.play = function( freq ) {
var N = Math.round( this.sr / freq ),
impulse = this.sr / 1000,
y = new Float32Array( N ),
View MediaElementSource.js
// see http://jsbin.com/okoxiq/3/edit
var src
, fftSize = 1024
, audio = new Audio()
, ac = new webkitAudioContext()
, analyser = ac.createAnalyser()
, timeData = new Uint8Array(fftSize)
, bar = document.querySelector('.bar')
, url = 'http://static1.kevincennis.com/sounds/callmemaybe.mp3';
@kevincennis
kevincennis / markov.js
Last active Jul 23, 2019
Quick and dirty Markov chain text generator
View markov.js
// basic usage: new Markov(lotsOfText).generate()
// markov chain constructor
//
// @string input {example text}
// @integer len {optional # of words to output}
// @integer stateSize {optional chain order}
function Markov( input, len, stateSize ){
this.cache = Object.create(null)
this.words = input.split(/\s/)
View curry.js
function curry( fn ) {
var arity = fn.length;
return (function resolver() {
var mem = Array.prototype.slice.call( arguments );
return function() {
var args = mem.slice();
Array.prototype.push.apply( args, arguments );
return ( args.length >= arity ? fn : resolver ).apply( null, args );
};
View reverse.js
function reverse( str ) {
if ( str.length <= 1 ) {
return str;
}
return reverse( str.substr( 1 ) ) + str[ 0 ];
}
@kevincennis
kevincennis / music.js
Last active Jan 20, 2019
simple, lightweight sequencer in javascript with the web audio api
View music.js
// For more documentation and a newer version,
// check out the full repo: https://github.com/kevincennis/TinyMusic
@kevincennis
kevincennis / elasticsearch.sh
Created Jan 9, 2019
Elasticsearch Codeship
View elasticsearch.sh
#!/bin/bash
# Install a custom ElasticSearch version - https://www.elastic.co/products/elasticsearch
#
# To run this script in Codeship, add the following
# command to your project's test setup command:
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/elasticsearch.sh | bash -s
#
# Add at least the following environment variables to your project configuration
# (otherwise the defaults below will be used).
# * ELASTICSEARCH_VERSION
@kevincennis
kevincennis / gist:3928503
Created Oct 21, 2012
Instant karaoke track with the Web Audio API
View gist:3928503
var url = 'http://static1.kevincennis.com/sounds/callmemaybe.mp3'
, audio = new Audio(url)
, context = new webkitAudioContext()
// 512 samples per frame, stereo input, mono output
, processor = context.createJavaScriptNode(512, 2, 1)
, sourceNode
audio.addEventListener('canplaythrough', function(){
sourceNode = context.createMediaElementSource(audio)
sourceNode.connect(processor)
You can’t perform that action at this time.