Skip to content

Instantly share code, notes, and snippets.

View doc22940's full-sized avatar

Acampbell doc22940

View GitHub Profile
@kiding
kiding / gist:589242021df49eb17be3
Last active December 3, 2019 23:57
safari-utm-stripper Bookmarklet
javascript:(function()%7Bvar%20e%3Dwindow.location.href%3Bvar%20t%3De.indexOf(%22%3F%22)%3Bif(e.indexOf(%22utm_%22)%3Et)%7Bvar%20n%3De.replace(%2F(%5B%3F%26%5Dutm_(source%7Cmedium%7Cterm%7Ccampaign%7Ccontent)%3D%5B%5E%26%23%5D%2B)%2Fig%2C%22%22)%3Bif(n.charAt(t)%3D%3D%3D%22%26%22)%7Bn%3Dn.substr(0%2Ct)%2B%22%3F%22%2Bn.substr(t%2B1)%7Dif(n!%3De)%7Bhistory.replaceState(null%2Cnull%2Cn)%7D%7D%7D)();
@kastnerkyle
kastnerkyle / Instantaneous Frequency and Phase Derivatives.ipynb
Created March 20, 2019 16:13
Instantaneous frequency and rainbowgrams with librosa.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tencia
tencia / vae_simple.py
Last active February 25, 2020 13:09
Variational Auto-Encoder using Lasagne
import sys
import os
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import time
from PIL import Image
from scipy.stats import norm
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
@cowboy
cowboy / bird-map.js
Created October 27, 2017 14:31
i made a bird map
'bird'
.split(/^(.)(.)(.)/)
.map(''.constructor.call.bind(''.repeat))
.filter(''.constructor)
.map(''.constructor.call.bind(''.charCodeAt))
.map(n=>n<100?100:n<101?107:n<106?111:n)
.map(''.constructor.fromCharCode)
.join('')
function getAdder(a) {
return function(b) {
return a + b;
};
}
// Another way to write the same is this:
// const getAdder = a => b => a + b;
const addOne = getAdder(1);
@cowboy
cowboy / dispatch-reparse.js
Last active February 25, 2020 20:53
react-redux mapDispatchToProps helper
const reparse = require('../actions/reparse');
module.exports = function mapDispatchToPropsPlusReparse(fn) {
return function(dispatch, ownProps) {
function reparse() {
return dispatch(reparse(true));
}
return Object.assign({reparse: reparse}, fn ? fn(dispatch, ownProps) : {});
};
};
@cowboy
cowboy / heredoc.js
Last active February 25, 2020 20:53
WIP: ES2015 heredoc helper
function chainOptions(props, fn) {
function getWrapper(options = {}) {
const wrapper = (...args) => fn(options, ...args);
props.forEach(prop => {
Object.defineProperty(wrapper, prop, {
enumerable: true,
get() {
return getWrapper(Object.assign({}, options, {[prop]: !options[prop]}));
},
set() {},
@cowboy
cowboy / indentation.js
Last active February 25, 2020 20:54
JavaScript: chained method indentation
// Inspired by the eslint-plugin-react wrap-multilines rule
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md
//
// I don't know why, but this is making me really happy right now.
// Instead of this
var someName = namespace.someObj.method1({
prop: 'value',
}).method2('foo', 'bar');
@cowboy
cowboy / index.js
Created September 16, 2016 16:01
Webpack: build error converting a lib's ... spread operator to ES5?
// npm install && npm run build
// In output.js, spreadTest(...args) is converted to ES5
function spreadTest(...args) {
return args;
}
console.log(spreadTest(1, 2, 3));
// But the ...args inside of this lib's "audit" function is NOT converted to ES5
import 'react-axe';
@doc22940
doc22940 / gist:b965f90023508c3fa3e5569ddc9bb507
Created March 6, 2020 00:31 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: