Skip to content

Instantly share code, notes, and snippets.

View BinaryMuse's full-sized avatar
🏳️‍🌈
Just gayin' up the place the best I can

Michelle Tilley BinaryMuse

🏳️‍🌈
Just gayin' up the place the best I can
View GitHub Profile
@BinaryMuse
BinaryMuse / README.md
Last active August 29, 2015 14:07
keyMirror with namespaces
var data = keyMirror({
  ONE: null,
  TWO: null,
  
  OTHER: keyMirror({
    STUFF: null
  }, "OTHER")
});
@BinaryMuse
BinaryMuse / overrides.js
Created September 20, 2014 08:14
setTimeout via Web Worker
var timeoutId = 0;
var timeouts = {};
var worker = new Worker("/static/timeout-worker.js");
worker.addEventListener("message", function(evt) {
var data = evt.data,
id = data.id,
fn = timeouts[id].fn,
args = timeouts[id].args;
@BinaryMuse
BinaryMuse / README.md
Last active February 1, 2017 00:51
Integrating React with Marionette

Integrating React with Marionette

See ReactComponentView and BackboneModelWatchMixin, below.

Notes

The BackboneModelWatchView could use some additional methods to allow adding/removing watched models after the component is created.

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@BinaryMuse
BinaryMuse / gist:e615814ae70f0b6f5460
Last active August 29, 2015 14:01
ChangingModelPropMixin
ChangingModelPropMixin = function(propName, handlerName) {
return {
componentWillReceiveProps: function(nextProps) {
if (nextProps[propName] && nextProps[propName] !== this.props[propName]) {
this.props[propName].removeListener("change", this[handlerName]);
nextProps[propName].on("change", this[handlerName]);
}
},
componentDidMount: function () {
@BinaryMuse
BinaryMuse / gist:9592591
Last active August 29, 2015 13:57
Highlight react DOM
setInterval(function() {
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(node) {
node.style.backgroundColor = 'rgba(255, 0, 0, 0.1)';
})
}, 500)
angular.module('app.common.directives.html-editor', [])
.directive('htmlEditor', function() {
return {
restrict: 'E',
scope: {
'html': '='
},
link: function (scope, element, attrs, ctrl) {
// this is a browserify bundle where my react components live
@BinaryMuse
BinaryMuse / gist:8697520
Created January 29, 2014 21:23
OS X Command Line Fu

Text File Operations

Reverse the lines of a file

tail -r file

Join each line of a file together with a character

@BinaryMuse
BinaryMuse / README.md
Created January 23, 2014 04:13 — forked from mbostock/.block
@BinaryMuse
BinaryMuse / README.md
Last active January 4, 2016 05:08 — forked from mbostock/.block

A simple example drawing a great arc as a LineString. The projection is rotated to avoid interrupting the arc. See also an earlier example with multiple great arcs.