Skip to content

Instantly share code, notes, and snippets.

View GavinJoyce's full-sized avatar

Gavin Joyce GavinJoyce

View GitHub Profile
var MidiStream = require('midi-stream');
var push = MidiStream('Ableton Push 2 User Port');
push.on('data', function(data) {
var instruction = data[0];
var note = data[1] - 36;
var row = Math.floor(note / 8);
var column = note % 8;
@GavinJoyce
GavinJoyce / gist:4f81d0bf879dad6b203e
Last active November 20, 2020 04:01
speeding up `npm install` by disabling the progress bar
with `react-native`:
npm set progress=false && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 83.72s user 26.03s system 100% cpu 1:49.32 total
npm set progress=true && rm -rf ~/.npm && rm -rf node_modules && npm cache clean && time npm install
npm install 199.30s user 27.32s system 91% cpu 4:08.29 total
--
This file has been truncated, but you can view the full file.
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
@GavinJoyce
GavinJoyce / ember-listbox.js
Last active June 18, 2020 18:20
vue / ember listbox comparison
// NOTE: this Ember app is presented in a similar way to the Vue app below to aid comparison.
// The actual app can be found here: https://github.com/GavinJoyce/tailwind-select-spike
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { guidFor } from "@ember/object/internals";
import { debounce } from "@ember/runloop";
function isString(value) {
<div class="p-48 antialised font-sans test-gray-900">
<div class="max-w-xs mx-auto">
<Dropdown />
</div>
</div>
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
let id = 0;
export default class extends Component {
@tracked items = [];
@action
@GavinJoyce
GavinJoyce / 1. raw_handlebars.js
Last active March 14, 2020 05:14
Ember Templates
//<p class="name">hi {{name}}</p>
Handlebars.templates["hi"]=function(data) {
return "<p class=\"name\">hi "
+ escapeExpression(data['name'])
+ "</p>\n";
});
@GavinJoyce
GavinJoyce / application.hbs
Last active March 2, 2020 15:22
Contextual components
<Modal
@title="This is the title"
@body="This is the <i>body</i>"
/>
<Modal as |modal|>
<modal.Title as |title|>
This is the <i>title</i>!
</modal.Title>
<modal.Body as |body|>
@GavinJoyce
GavinJoyce / gist:4004b6ad7dda427e629f
Last active February 15, 2020 08:12
jQuery event leak detection
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild;
while (node) {
walk(node, func);
node = node.nextSibling;
}
};
var totalSubscriptionCount = 0;