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 / gist_tag.rb
Created January 31, 2011 00:44
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@BinaryMuse
BinaryMuse / ContextRemoteServiceServlet.java
Created July 14, 2010 22:09
policy file fix for GWT app behind reverse proxy
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.google.gwt.user.server.rpc.SerializationPolicy;
import com.google.gwt.user.server.rpc.SerializationPolicyLoader;
@insin
insin / BootstrapModalMixin.js
Last active February 5, 2021 07:47
A Bootstrap (3) modal mixin for React / MIT License
/** @jsx React.DOM */
var BootstrapModalMixin = function() {
var handlerProps =
['handleShow', 'handleShown', 'handleHide', 'handleHidden']
var bsModalEvents = {
handleShow: 'show.bs.modal'
, handleShown: 'shown.bs.modal'
, handleHide: 'hide.bs.modal'
@rob-brown
rob-brown / ElixirConf2014.md
Last active December 4, 2020 05:38
Notes from ElixirConf 2014

ElixirConf 2014

Dave Thomas—Opening Keynote

Twitter | Slides

Think different(ly)

Get out of your rut and learn new ways to think.

@smashwilson
smashwilson / init.js
Last active April 29, 2020 17:45
Init script blurb to fold mocha, jasmine, or minitest tests down to the "it" blocks
atom.commands.add('atom-text-editor', 'me:fold-to-it', event => {
const editor = event.target.closest('atom-text-editor').getModel()
const languageMode = editor.getBuffer().getLanguageMode()
if (!languageMode.tree) return
editor.unfoldAll()
const startsWith = (node, text) => {
const startPosition = new Point(node.startPosition.row, node.startPosition.column)
const endPosition = startPosition.traverse([0, text.length])
@BinaryMuse
BinaryMuse / webpack.config.js
Last active August 29, 2019 13:44
webpack less -> css with source maps via extracttextplugin
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var lessLoader = ExtractTextPlugin.extract(
"css?sourceMap!less?sourceMap"
);
module.exports = {
cache: true,
entry: { bundle: "./master/client/index.jsx" },
var context = new webkitAudioContext();
var offline = new webkitOfflineAudioContext(2, 10 * 44100, 44100);
var blob;
var bufferLoader;
bufferLoader = new BufferLoader(
context, [
'/sound/sound1.mp3',
],
finishedLoading
@jessykate
jessykate / Jekyll nd Octopress Liquid tag for MathJax.rb
Created February 18, 2011 23:37
A simple liquid tag for Jekyll/Octopress that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end
@jondlm
jondlm / README.md
Last active January 3, 2018 05:59
React shallow render lifecycle breakdown

React introduced shallow rendering in 0.13. This is an excellent feature that I wish was included earlier in React. It aims to solve the problem of unit testing components without going through a real, or jsdom mocked, DOM. I couldn't find any info online about what lifecycle events it actually fires. So I did some testing of my own. To reproduce, put component.js and test.js into a folder and run node test.js.

TLDR; shallow rendering only invokes the following lifecycle hooks (in order):

  1. getDefaultProps
  2. getInitialState
  3. componentWillMount stops here until re-render
  4. componentWillReceiveProps
  5. shouldComponentUpdate
  6. componentWillUpdate
@aaronjensen
aaronjensen / connect.jsx
Last active July 28, 2017 18:43
Redux shim for converting from Fluxxor
const React = require('react');
const mapValues = require('lodash/object/mapValues');
const createGetState = require('app/redux_shims/create_get_state');
const Fluxxor = require('fluxxor');
const FluxMixin = Fluxxor.FluxMixin(React);
const StoreWatchMixin = Fluxxor.StoreWatchMixin;
const createDispatcher = require('app/redux_shims/create_dispatcher');
const Router = require('react-router');
function bindActionCreator(flux, router, action) {