Skip to content

Instantly share code, notes, and snippets.

🏳️‍🌈
Just gayin' up the place the best I can

Michelle Tilley BinaryMuse

🏳️‍🌈
Just gayin' up the place the best I can
Block or report user

Report or block BinaryMuse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@BinaryMuse
BinaryMuse / gist:8697520
Created Jan 29, 2014
OS X Command Line Fu
View gist:8697520

Text File Operations

Reverse the lines of a file

tail -r file

Join each line of a file together with a character

View html-editor.directive.js
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:9592591
Last active Aug 29, 2015
Highlight react DOM
View gist:9592591
setInterval(function() {
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(node) {
node.style.backgroundColor = 'rgba(255, 0, 0, 0.1)';
})
}, 500)
@BinaryMuse
BinaryMuse / gist:e615814ae70f0b6f5460
Last active Aug 29, 2015
ChangingModelPropMixin
View gist:e615814ae70f0b6f5460
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 () {
View GIF-Screencast-OSX.md

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 / README.md
Last active Aug 29, 2015
keyMirror with namespaces
View README.md
var data = keyMirror({
  ONE: null,
  TWO: null,
  
  OTHER: keyMirror({
    STUFF: null
  }, "OTHER")
});
@BinaryMuse
BinaryMuse / gist:1ef56674787db244343a
Last active Aug 29, 2015
Add .done to native ES6 Promises
View gist:1ef56674787db244343a
/* Native HTML5 promises will swallow exceptions if you're not careful. For example:
*
* promise.then(function() {
* something.froEach(iterator);
* });
*
* This extension patches the Promise prototype with a `done` method that will log errors:
*
* promise.then(function() {
* something.froEach(iterator);
@BinaryMuse
BinaryMuse / EmbeddedGwt.java
Created Mar 28, 2010
DND - Serving GWT app with embedded Java - used on blog
View EmbeddedGwt.java
package net.binarymuse.EmbeddedGwt;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.WebAppContext;
public class EmbeddedGwt {
public static void main(String[] args) throws Throwable {
View sailthru_settings.txt
HTML Template:
{foreach releases as release}
<h1><a href="{release.link}">{release.title}</a></h1>
<p>{release.teaser}</p>
{/foreach}
<p><small>If you believe this has been sent to you in error, please safely <a href="{optout_confirm_uri}">unsubscribe</a>.</small></p>
Feed URL:
View DND (blog): git on prompt.sh
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ (\1$(parse_git_stash))/"
}
parse_git_stash() {
git stash list 2> /dev/null | wc -l | sed -e "s/ *\([0-9]*\)/\ \+\1/g" | sed -e "s/ \+0//"
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print " ("$1 "/" $2 ")"}'
}
parse_svn_url() {
You can’t perform that action at this time.