Skip to content

Instantly share code, notes, and snippets.

View leebyron's full-sized avatar
🌎

Lee Byron leebyron

🌎
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-with-addons-0.12.0.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-with-addons-0.12.0.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# first load in the master bash
if [ -f /etc/master_bash ]; then
. /etc/master_bash
var tree = Immutable.fromJS(
{id: 0, children: [{id: 1, children: [{id: 2}, {id: 3}]}, {id: 4, children: [{id: 5}, {id: 6}]}]}
);
function reduceFn(list, item) {
var children = item.get('children');
list = children ? children.reduce(reduceFn, list) : list;
list = list.push(Immutable.Map({id: item.get('id')}));
return list;
}

Additonal export-from statements in ES7

The export ___ from "module" statements are a very useful mechanism for building up "package" modules in a declarative way. In the ES6 spec, we can export through a single export with export {x} from "mod", optionally renaming it with export {x as v} from "mod". We can also spread all exports with export * from "mod".

These three export-from statements are easy to understand if you understand the semantics of the similar looking import statements.

@leebyron
leebyron / privatemethods.js
Last active August 29, 2015 14:17
How might "private methods" be transpiled to define a semantic behavior?
// Private methods (instance and static) are different from private properties
// because they are not assigned per instance. Instead, they can be thought of
// as a nested function, scoped to the class body.
// Resolution of a private `@x()` method can be done with brand checks, but
// inlined when the resolution can be determined statically.
class C {
m(somethingElse) {
somethingElse.@x();
@leebyron
leebyron / index.js
Created April 16, 2015 19:44
requirebin sketch
'use strict';
var React = require('react');
var Immutable = require('immutable');
var Map = Immutable.Map;
var List = Immutable.List;
var Component = React.createClass({
displayName: 'Component',
TN:
SF:/Users/leebyron/src/dataloader/src/__tests__/abuse-test.js
FN:15,_interopRequireDefault
FN:25,(anonymous_2)
FN:27,(anonymous_3)
FN:28,(anonymous_4)
FN:32,(anonymous_5)
FN:37,(anonymous_6)
FN:38,(anonymous_7)
FN:42,(anonymous_8)
String make = columns[0];
int id = int(columns[4]);
String model = columns[1];
int year = int(columns[2]);
String trim = columns[5];
int trade_in_value_excellent = 0;
int trade_in_value_good = 0;
int trade_in_value_fair = 0;
int private_party_value_excellent = 0;
@leebyron
leebyron / Example Use
Created June 14, 2011 23:20
innernets
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
// check for future network connectivity changes
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateNetStatus:)
name:kNetConnectionChangeNotification
object:[NetConnection netConnection]];
}
- (void)updateNetStatus:(NSNotification *)notif