Skip to content

Instantly share code, notes, and snippets.

Avatar
🍵

Trevor Burnham TrevorBurnham

🍵
View GitHub Profile
@TrevorBurnham
TrevorBurnham / keybindings.json
Created Oct 7, 2020
VS Code Custom Keyboard Shortcuts
View keybindings.json
[
{
"key": "ctrl+t",
"command": "extension.transpose"
},
{
"key": "ctrl+cmd+w",
"command": "workbench.action.closeAllEditors"
},
{
@TrevorBurnham
TrevorBurnham / after.json
Created Aug 24, 2020
Ad dashboard "Key Insights" data: Before and After
View after.json
{
"id": "listingPaidAdsViewsByKeyInsights",
"chart": {
"keyInsightsChart": {
"title": "Key Insights",
"insights": [
{
"valueSeriesRef": {
"ref": {
"dfId": "df_f3cbe2d40f33adb24cdf43ae6a963aad",
@TrevorBurnham
TrevorBurnham / benchmark.js
Created Jan 17, 2019
Shallow-Compare Benchmark
View benchmark.js
// This code can be run in the Chrome console
const benchmark = () => {
const UIAccordionItem = hubspot.getLoadedModules()['UIComponents/accordion/UIAccordionItem'];
const REPS = 1e6;
const instance = {
props: {
...UIAccordionItem.defaultProps,
children: 'Hello',
View TidalAB.js
/*
Tidal A/B Test Script
So you want to see if you and your friends can hear the difference between
lossless streaming and 320kbps in Tidal? This script will help! Instructions:
1. Log in to the Tidal web player at http://listen.tidalhifi.com/
2. Set up a playlist with a handful of songs you like a lot. Here's mine:
tidal.com/playlist/28d66a7c-f29f-47b3-b062-ba06e4b8883b
2. In the code below, set `playlistTitle` to match the name of that playlist.
@TrevorBurnham
TrevorBurnham / git-good.md
Last active Oct 24, 2019
Git Good Practices: A Totally Uncontroversial Guide
View git-good.md

Know what changes you're making, every step of the way

Give yourself as many chances as you can to catch your mistakes before you push them:

  1. Use an editor plugin like Sublime Text's GitGutter so you can always see which parts of a file you've changed. (More precisely, it shows the diff of the file between the working directory and HEAD.)
  2. Not sure whether to stage your unstaged changes? Use git diff with no arguments. It shows the difference between your working directory and the index.
  3. Not sure whether to commit your staged changes? Use git diff --staged. It shows the difference between your index and HEAD.
  4. When you decide to commit, use git commit --verbose, no -m, and take one last look at the changes in your editor. (Make sure it's got a nice Git Commit Message syntax, like the one in the Sublime Text Git package, so the list of changes is nice and colorized.) You can't edit the changes directl
@TrevorBurnham
TrevorBurnham / gist:3350746
Created Aug 14, 2012
Using destructuring in a loop
View gist:3350746
# Old code
_temp.key for _temp in arr
# Shiny new code!
key for {key} in arr
View gist:2839176
mainWindow.menu("File", function(err, file) {
if(err) throw err;
file.openMenu(function(err, menu) {
if(err) throw err;
menu.item("Open", function(err, item) {
if(err) throw err;
item.click(function(err) {
if(err) throw err;
mainWindow.getChild(type('Window'), function(err, dialog) {
if(err) throw err;
View embedly-jquery.html
<!DOCTYPE>
<html>
<head>
<title>Page Title</title>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://scripts.embed.ly/jquery.embedly.min.js"></script>
<script type="text/javascript">
$('document').ready(function(){
$('div.content').embedly({
maxWidth: 450,
View gist:2603860
$ gdb --args ./bin/node_g -e "require('fs').watch('a.txt', function(){});"
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done
(gdb) run
View gist:2603829
$ gdb --args ./bin/node_g -e "require('fs').watch('a.txt', function(){});"
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done
(gdb) run
You can’t perform that action at this time.