Skip to content

Instantly share code, notes, and snippets.


Anders Anton supermensa

View GitHub Profile
alexeisavca / ReactIgnore
Last active Jan 30, 2019
A simple component to make ReactJs ignore subtrees
View ReactIgnore
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
render (){
return React.Children.only(this.props.children);
oxguy3 / htmlDecode
Created Dec 7, 2014
A function for decoding html entities in an html string
View htmlDecode
function htmlDecode( input ) {
return String(input)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>');
akre54 / backbone.fetch.js
Last active Apr 17, 2020
Backbone.ajax with window.fetch
View backbone.fetch.js
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
return obj;
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {
View router.js
"use strict";
var _ = SM.import('lodash');
var DOM = SM.import('sm-dom');
var Uri = SM.import('sm-uri');
// WebKit (as of version 538.35.8) fires a useless popstate event after every
// page load, even when the page wasn't popped off the HTML5 history stack. We
// only want to handle popstate events that result from a page actually being
// popped off the HTML5 history stack, so we need a way to differentiate between
gilbert / functions.js
Last active Sep 20, 2016
JavaScript Function Extensions
View functions.js
// Partially apply arguments to a function. Useful for binding
// specific data to an event handler.
// Example:
// var add = function (x,y) { return x + y }
// var add5 = add.papp(5)
// add5(7) //=> 12
Function.prototype.papp = function () {
var slice = Array.prototype.slice
kevinelliott /
Last active Dec 28, 2020
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

staltz /
Last active Jan 15, 2021
The introduction to Reactive Programming you've been missing
DanHerbert /
Last active Dec 27, 2020
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

nijikokun / console.js
Created Nov 17, 2013
Custom console logging system
View console.js
* Custom Logging Module to support older browsers & timestamp in console log.
* Caveats:
* - Errors are not logged on the correct line.
* @param {String} environment
* @return {Object}
nijikokun /
Last active Dec 27, 2015
The easiest, and most comprehensible class system for JavaScript using prototypal inheritance and Object.create. Also contains an additional chaining method, that isn't required but simplifies your code. Outputs the cleanest objects as far as Class Systems go.


After looking for a simple Class system in JavaScript, and looking at all the horrible libraries, forced upon terrible syntax, cluttered objects and prototypes... I'd like to introduce a simple alternative.

This is a very bare-bones, and yet one of the more powerful class systems in JavaScript. Built on-top of Object.create and prototype inheritance using the methods that everyone suggests is the best way to do classes in JavaScript ported over to a nicer syntax.

It doesn't clutter the properties or the prototype aside from a single method which is extends, and even this method is sugar and not required!

Check out zoo.js for an in-depth example of how to use Class. No matter how deep down the rabbit hole you go, it should keep references so you can do instanceof checks on children of a parent of a grand-parent and so forth.

You can’t perform that action at this time.