Skip to content

Instantly share code, notes, and snippets.

View ralphtheninja's full-sized avatar
🏠
Working from home

ralphtheninja

🏠
Working from home
View GitHub Profile
sudo apt-get update
sudo apt-get install -y git-core build-essential libssl-dev libboost-all-dev libdb5.1-dev libdb5.1++-dev libgtk2.0-dev
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/src
make -f makefile.unix clean; make -f makefile.unix USE_UPNP= bitcoind

Put a closure on it

Sometimes you'll have objects that manage state along with event handling. This happens frequently in MVC apps. Let's start with a messy example:

var Launcher = function(rocket) {
  this.rocket = rocket
}

Launcher.prototype.isReady = function() {

// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
// Copyright © 2013 Darach Ennis. All rights reserved.
//
// Sample EEP/Beam AR drone integration.
// Works with keyboard
// Works with a makey makey - http://www.makeymakey.com/
// Coded during NodeConf EU but not demonstrated or tested ...
//
// Enjoy!
//
import tweepy
import time
import re
import pycoin.encoding
import pickle
# Removed security tokens from gist, replaced with XXX.
auth = tweepy.OAuthHandler("XXX", "XXX")
auth.set_access_token('XXX', 'XXX')

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@ralphtheninja
ralphtheninja / Makefile
Last active August 29, 2015 14:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@ralphtheninja
ralphtheninja / Makefile
Last active August 29, 2015 14:13 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
#squatconf 2, Kickoff
Hi there, Some of us started to talk about the 2nd edition of squatconf, and this mailing list if a perfect point to start a broader discussion about it and share the infos for the one that was not there
what was actually talked about :
Location :
- BARCELONA
- Amsterdam (ping realitygaps, webmind)

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to inmiment obsoletion. The tools are changing and evolving quickly, and some of this knowledge is likely to become outdated in the coming months or even weeks.

The tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. It features: