Skip to content

Instantly share code, notes, and snippets.

View dengjonathan's full-sized avatar

Jon Deng dengjonathan

View GitHub Profile
@dengjonathan
dengjonathan / avltree.js
Created January 16, 2017 19:27
Javascript AVL Tree
// AVLTree ///////////////////////////////////////////////////////////////////
// This file is originally from the Concentré XML project (version 0.2.1)
// Licensed under GPL and LGPL
//
// Modified by Jeremy Stephens.
// Pass in the attribute you want to use for comparing
function AVLTree(n, attr) {
this.init(n, attr);
}
@dengjonathan
dengjonathan / .eslintrc
Created October 17, 2016 15:40 — forked from glennr/.eslintrc
ESLint config for React + Redux projects
{
"parser": "babel-eslint", // I want to use babel-eslint for parsing!
"rules": {
"comma-dangle": 0, // dangling commas are ok
"indent": [2, 2, {
"SwitchCase": 1
}],
"jsx-quotes": 1,
"linebreak-style": [2, "unix"],
"quotes": [2, "single"],
@dengjonathan
dengjonathan / .eslintrc.js
Last active October 7, 2016 15:38 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@dengjonathan
dengjonathan / static_server.js
Created September 24, 2016 03:59 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };