This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trimSilenceFromBuffer(buffer, threshold = 0.001, minSilenceDuration = 0.1) { | |
const sampleRate = Tone.context.sampleRate; | |
const channelData = buffer.getChannelData(0); // Assuming mono audio for simplicity | |
let endOfAudioIndex = channelData.length - 1; | |
let silenceDuration = 0; | |
// Iterate backwards through the buffer | |
for (let i = channelData.length - 1; i >= 0; i--) { | |
const sample = Math.abs(channelData[i]); // Get the absolute value of the sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.rdiff '!g() { origin=$(git config --get remote.origin.url | sed "s/git@/https:\/\//g" | sed "s/.com:/.com\//g"); url=${origin/.git/\/commit\/$(git rev-parse HEAD)}; open $url; }; g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git Destroy | |
# Deletes a branch locally and on the origin | |
# git destroy <branch> | |
git config --global alias.destroy '!g() { git branch -D $1 && git push origin $1 --delete; }; g' | |
# Git Circle CI | |
# Opens the projects builds in Circle | |
# git cci | |
git config --global alias.cci '!g() { branch=`git rev-parse --abbrev-ref HEAD`; top_level=`git rev-parse --show-toplevel`; repo=`basename $top_level`; url="https://circleci.com/gh/MakerStudios/$repo/tree/$branch"; open $url; }; g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"purchase": { | |
"id": "i-am-obfuscated", | |
"cart": { | |
"lineItems": [ | |
{ | |
"product": { | |
"sku": "i-am-sku", | |
"name": "hello world", | |
"unitPrice": 5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { compose } from 'redux' | |
import { connect } from 'react-redux' | |
import { addToCart } from '../actions' | |
import { fetchProducts } from '../decorators' | |
const mapDispatchToProps = (dispatch) => ({ | |
add (product) { | |
dispatch(addToCart(product)) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { compose } from 'redux' | |
import { connect } from 'react-redux' | |
import { addToCart } from '../actions' | |
import { fetchProducts } from '../decorators' | |
const mapDispatchToProps = (dispatch) => ({ | |
add (product) { | |
dispatch(addToCart(product)) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserRouter as Router, Route } from 'react-router-dom' | |
import Upsell from './containers/Upsell' | |
import AddonsView from './components/AddonsView' | |
import ExtrasView from './components/Extras' | |
const Addons = Upsell({ | |
view: AddonsView, | |
products: ['shave-butter', 'hair-gel', 'butt-wipes'], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var toMoney = function(num){ | |
return '$' + (num.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') ); | |
}; | |
var handler = function(element, valueAccessor, allBindings){ | |
var $el = $(element); | |
var method; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// Shim with setTimeout fallback | |
window.requestAnimationFrame = function() { | |
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(f) { | |
window.setTimeout(f, 1e3 / 60) | |
} | |
}(); | |
function num_between(n1, n2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['foo', 'bar'], | |
isAwesome: true, | |
isNotAwesome: false, | |
}); |
NewerOlder