Skip to content

Instantly share code, notes, and snippets.

View jakiestfu's full-sized avatar
🌺

Jacob Kelley jakiestfu

🌺
View GitHub Profile
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
{
"purchase": {
"id": "i-am-obfuscated",
"cart": {
"lineItems": [
{
"product": {
"sku": "i-am-sku",
"name": "hello world",
"unitPrice": 5,
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))
},
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'],
})
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))
},
(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) {
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['foo', 'bar'],
isAwesome: true,
isNotAwesome: false,
});
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
shouldReloadAll: function() {
return true;
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
const {
computed,
get,
set,
} = Ember;
export default Ember.Component.extend({