Note, please replace "WWW/tools" with where ever you store your web tools.
$ mkdir ~/WWW/tools
$ cd ~/WWW/tools
$ git clone https://github.com/phacility/libphutil.git
$ git clone https://github.com/phacility/arcanist.git
| public class Retry { | |
| private static final Logger log = Logger.getLogger(Retry.class); | |
| public static interface CallToRetry<T> { | |
| <T> T doIt() throws Exception; | |
| } | |
| public static T withRetry(int maxTimes, long initialWait, int waitMultiplier, CallToRetry<T> call) { | |
| if(maxTimes <= 0) { |
| $ brew update | |
| $ brew install hive |
| 'use strict'; | |
| module.exports = function CustomError(message, extra) { | |
| Error.captureStackTrace(this, this.constructor); | |
| this.name = this.constructor.name; | |
| this.message = message; | |
| this.extra = extra; | |
| }; | |
| require('util').inherits(module.exports, Error); |
| # scala install | |
| wget www.scala-lang.org/files/archive/scala-2.11.7.deb | |
| sudo dpkg -i scala-2.11.7.deb | |
| # sbt installation | |
| echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823 | |
| sudo apt-get update | |
| sudo apt-get install sbt |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| var assert = require('chai').assert; | |
| var when = require('when'); | |
| var def1 = when.defer(); | |
| function getProm() { | |
| return def1.promise; | |
| } |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
| <!-- when.js Promises implementation --> | |
| <script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
| <!-- Unit testing and mocking framework --> | |
| <script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs