Skip to content

Instantly share code, notes, and snippets.

@royriojas
royriojas / index.js
Created Jul 28, 2015
requirebin sketch
View index.js
var data = window.jsonData;
var $ = require('jquery');
var React = require('react/addons');
var throttle = require('throttly');
var rand = function rand() {
var min, max,
args = arguments;
//if only one argument is provided we are expecting to have a value between 0 and max
if ( args.length === 1 ) {
max = args[ 0 ];
@royriojas
royriojas / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
var $ = require('jquery');
$(function () {
var React = require('react/addons');
var throttle = require('throttly');
var rand = function rand() {
var min, max,
args = arguments;
//if only one argument is provided we are expecting to have a value between 0 and max
@royriojas
royriojas / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the right
var esformatter = require( 'esformatter' );
var esformatterJSX = require( 'esformatter-jsx' );
var collapser = require('esformatter-collapse-objects')
var throttle = require('lodash.throttle');
var testCode = '// Paste your own code here...\n\n\n\ var Comment = React.createClass({\n render: function() {\n return (\n <div className="comment">\n <h2 className="commentAuthor">\n {this.props.author}\n </h2>\n {this.props.children}\n </div>\n );\n }\n});';
var supportStorage = true;
@royriojas
royriojas / index.js
Created Jul 7, 2015
requirebin sketch
View index.js
var w = window;
var $ = require('jquery');
var esformatter = require('esformatter');
$('.code-pair').each(function () {
var $this = $(this);
var source = $this.find('.source').text();
var $result = $this.find('.result');
View dynamic-transition.js
const React = require('react');
const dynamics = require('dynamics.js');
/**
* Using dynamics.js to transition things or just animate
* ------------------------------------------------------
* props:
* - runTo enum("start", "finish) - which way to run.
* - onComplete callback
* - onChange callback
@royriojas
royriojas / index.js
Created Jun 25, 2015
requirebin sketch
View index.js
var w = window;
var $ = require('jquery');
var esformatter = require('esformatter');
$('.code-pair').each(function () {
var $this = $(this);
var source = $this.find('.source').text();
var $result = $this.find('.result');
@royriojas
royriojas / install-deps.sh
Created Jun 18, 2015
Karma deps (including grunt)
View install-deps.sh
npm i --save-dev grunt-karma karma karma-chai-sinon karma-chrome-launcher karma-commonjs-plus karma-coverage karma-junit-reporter karma-mocha karma-osx-reporter karma-phantomjs-launcher karma-spec-reporter mocha sinon sinon-chai
@royriojas
royriojas / index.js
Created Jun 17, 2015
requirebin sketch
View index.js
var w = window;
var $ = require('jquery');
var esformatter = require('esformatter');
$('.code-pair').each(function () {
var $this = $(this);
var source = $this.find('.source').text();
var $result = $this.find('.result');
@royriojas
royriojas / index.js
Last active Aug 29, 2015
requirebin sketch
View index.js
/* =============================================================== */
// The following code is a small example of how to use React to
// create a very stupid an simple Cascade Dropdowns.
// In this classic type of UI elements the values of the second
// dropdown are the result of filtering a data set based on the
// value of the previous dropdown.
//
// In order to demonstrate this, I'm using the Territorial Division
// of Peru as an example.
// The following component will let the users pick a district.
@royriojas
royriojas / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console