Skip to content

Instantly share code, notes, and snippets.

@whichlight
whichlight / white-noise-gen.js
Created January 24, 2016 06:49
white noise generator in javascript
var whiteNoiseGen = function(){
var bufferSize = 4096; //Math.pow(2,13); //between 8 & 14
//make this a global var so it isnt garbage collected
whiteNoise = context.createScriptProcessor(bufferSize, 0, 2);
whiteNoise.onaudioprocess = function(e) {
var outputBuffer = e.outputBuffer;
for (var channel = 0; channel < outputBuffer.numberOfChannels; channel++) {
var outputData = outputBuffer.getChannelData(channel);
for (var i = 0; i < bufferSize; i++) {
@bgorkem
bgorkem / truncate.js
Last active February 22, 2023 14:59
truncation from the middle of the string..
/**
* this function will crop any given text to the size of the given target
* will crop in the middle
**/
function cropMiddle(target, text) {
var input,
inputFontStyle,
ellipsisWidth,
maxWidth,
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 300,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[