Nested ReactJS Components

February 17, 2015

Here's an example of how to create nested components with ReactJS. Note that this JSX code must be compiled to native JavaScript to work. While this is a trivial example, you can use nested components to build up complex user interfaces and share a parent's state in the props of its child. As the application becomes more complex, it . . .

Read More

State vs. Props in React.js Components

February 12, 2015

Components in React.js have two properties used to store data to display in HTML: the state and props objects. They're both plain JavaScript objects and both can be used in the render function of your components. Here I've summarized the difference between state and props, as well as their use cases.


state is useful when a . . .

Read More

FizzBuzz in React.js

Title says it all

February 11, 2015

Here's a simple index.html to start with:

<!doctype html> <html> <head> <meta charset="utf-8"> <title>Awesome FizzBuzz Incrementing</title> <!-- dependencies --> <script src=""></script> </head> <body> <script type= . . .

Read More

4 Instantiation Styles in JavaScript

Functional, Functional Shared, Prototypal, Pseudoclassical

February 05, 2015


var Dog = function(){ var dogInstance = {}; dogInstance.speak = function(){ console.log("woof!"); }; return dogInstance; }; 

Functional with shared methods

var DogMethods = { speak: function(){ console.log("woof!"); } }; var Dog = function(){ var instance = _.extend(DogMethods); return instance; }; 


 . . .

Read More

An Algorithm to Convert Decimals to Fractions in JavaScript

Num to Fraction String in 16 Lines

January 21, 2015
/**  * Write a function that takes a number as its argument and  * returns a string that represents that number's simplified fraction.  *  * Example: toFraction(0.5) === '1/2'  *  * Whole numbers and mixed fractions should be returned as irregular fractions  *  * Example: toFraction(3.0) === '3/1'  *  * Example: . . .

Read More

A Simple Event System In Python

A callback-based event system with and without class inheritance

January 06, 2015

cool terminal output

Here I made an easily digestible snippet to show how callback-based event systems work. It prints the output in the picture above when you run it in Terminal. The concept here is really easy, and I hope this post helps newbie developers understand event systems (Python is sooooo readable!). Here's the class inheritance-based . . .

Read More

Filesystem events on OS X command to monitor everything OH MY GOD SO MUCH IS HAPPENING

December 28, 2014

tl;dr type lsof and see EVERYTHING YOUR COMPUTER IS DOING ON THE FILESYSTEM #WhoDesignedThis #unix

Read More

  Subscribe by Email and Never Miss a Post