Skip to content

Instantly share code, notes, and snippets.

View tmpaul06's full-sized avatar

Tharun M Paul tmpaul06

View GitHub Profile
@tmpaul06
tmpaul06 / mango_promise.js
Last active July 3, 2017 07:21
Example promise gist
promise
.then(buyMangoes, dadStrategy);
// No error. No warning. Error is simply gone.
@tmpaul06
tmpaul06 / add.js
Created November 21, 2016 10:39
An example showing synchronous and asynchronous code execution
// A synchronous function.
// It returns a result as soon as it is called.
function syncAdd(a, b) {
return a + b;
}
// A function that adds two numbers after two seconds
function asyncAdd(a, b) {
setTimeout(function() {
return a + b;
@tmpaul06
tmpaul06 / Column.jsx
Last active August 29, 2015 14:23
Render a child with parent context info
import React from "react";
import BaseComponent from "../BaseComponent";
import DomEvents from "../utils/DomEvents";
export default class Column extends BaseComponent {
constructor() {
super();
this.state = {
parentWidth: null
};
this.mounted = false;