Skip to content

Instantly share code, notes, and snippets.

Avatar

Gavin Joyce GavinJoyce

View GitHub Profile
View gist:974028a20fbccac2b440421ce9765488
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 Nov 20, 2020
speeding up `npm install` by disabling the progress bar
View gist:4f81d0bf879dad6b203e
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
--
View default-tailwind.css
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 Jun 18, 2020
vue / ember listbox comparison
View ember-listbox.js
// 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) {
View templates.application\.hbs
<div class="p-48 antialised font-sans test-gray-900">
<div class="max-w-xs mx-auto">
<Dropdown />
</div>
</div>
View components.outer\.js
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
View 1. raw_handlebars.js
//<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 Mar 2, 2020
Contextual components
View application.hbs
<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 Feb 15, 2020
jQuery event leak detection
View gist:4004b6ad7dda427e629f
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild;
while (node) {
walk(node, func);
node = node.nextSibling;
}
};
var totalSubscriptionCount = 0;
View Ember Dublin: Octane preview workshop.md