This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creates a promise object which will either resolve or reject | |
const Promise = function (executor) { | |
const _thens = []; | |
let _catch; | |
const promise = { | |
then: cb => { | |
_thens.push(cb); | |
return promise; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Server = require('./server.js'); | |
const webpack = require('webpack'); | |
let config; | |
const port = (process.env.PORT || 8080); | |
const app = Server.app(); | |
if (process.env.NODE_ENV === 'development') { | |
const webpackDevMiddleware = require('webpack-dev-middleware'); | |
const webpackHotMiddleware = require('webpack-hot-middleware'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"env": { | |
"node": true, | |
"es6": true | |
}, | |
"ecmaFeatures": { | |
"arrowFunctions": true, | |
"blockBindings": true, | |
"classes": true, | |
"defaultParameters": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="counter"> | |
<button @click="up()">+</button> | |
<p id="count">{{ value }}</p> | |
<button @click="down()">-</button> | |
</div> | |
<script> | |
var counter = new Vue({ | |
el: '#counter', | |
data: { | |
value: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vanilla JS MVC</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count">0</p> | |
<button id="down">-</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Counter.jsx | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// PRESENTATIONAL COMPONENT: a simple stateless React View | |
const Button = ({onClick, label}) => ( | |
<button onClick={onClick}>{label}</button> | |
); | |
// REACT COMPONENT: a stateful React View (stored in this.state) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vanilla JS</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count">0</p> | |
<button id="down">-</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {createStore} from 'redux'; | |
import {connect, Provider} from 'react-redux'; | |
/********************************REDUX*****************************************/ | |
//default state | |
const INITIAL_STATE = { | |
value: 0 | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {createStore} from 'redux'; | |
import {connect, Provider} from 'react-redux'; | |
/********************************REDUX*****************************************/ | |
//default state | |
const INITIAL_STATE = { | |
value: 0 | |
}; |