Skip to content

Instantly share code, notes, and snippets.

View ericclemmons's full-sized avatar
🏠
Working from home

Eric Clemmons ericclemmons

🏠
Working from home
View GitHub Profile
@ericclemmons
ericclemmons / HappyFactory.js
Created August 27, 2015 02:42
ES6 Classes as Factories
class HappyFactory {
constructor(message) {
return Promise.resolve(`${message} there!`);
}
}
new HappyFactory("Howdy").then(::console.log);
// "Howdy there!"
@ericclemmons
ericclemmons / 0_reuse_code.js
Created August 6, 2014 13:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ericclemmons
ericclemmons / javascript_resources.md
Created August 6, 2014 13:09 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@ericclemmons
ericclemmons / jstransform-require.js
Created August 12, 2014 03:50
JSTransform require.extension to auto-magically convert ES6 to ES5 during runtime.
var fs = require('fs');
var jstransform = require('jstransform');
var path = require('path');
var js = require.extensions['.js'];
module.exports = function(visitors) {
visitors = visitors.reduce(function(visitors, visitor) {
return visitors.concat(visitor.visitorList);
}, []);
@ericclemmons
ericclemmons / bootstrap.jsx
Created October 6, 2014 18:29
Gulp + Webpack + React is SLOW
/**
* @jsx React.DOM
*/
var React = require('react');
var Router = require('react-router');
var Routes = Router.Routes;
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
@ericclemmons
ericclemmons / FluxContainer.js
Last active August 29, 2015 14:17
Flummox FluxContainer that runs actions, watches stores, and renders a component.
import assign from "object-assign";
import Flux from "flummox";
import React from "react";
export default React.createClass({
displayName: "FluxContainer",
contextTypes: {
flux: React.PropTypes.instanceOf(Flux),
},
@ericclemmons
ericclemmons / .eslintrc
Created March 24, 2015 03:52
My latest .eslintrc
{
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": false,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": false,
"generators": true,
@ericclemmons
ericclemmons / My_Db_Table.php
Created June 15, 2009 20:35
Add "findBy" magic method to Zend_Db_Table objects
<?php
/**
* My_Db_Table
*
* Adds "findBy" magic method to Zend_Db_Table objects
*
* @author Eric Clemmons
**/
@ericclemmons
ericclemmons / svndiff
Created August 12, 2009 16:29
Run "svndiff" and view the results in FileMerge (OS X)
#!/usr/bin/python
from sys import argv
from os import execlp
import re
left = "";
right = "";
@ericclemmons
ericclemmons / Error.js
Created September 8, 2009 20:27
demo.ui.Error.js
// Register this class autoloading
dojo.provide('demo.ui.Error');
// Include dependencies
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
// Create class declaration extending templating system
dojo.declare('demo.ui.Error', [dijit._Widget, dijit._Templated], {