(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.
(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.
| #!/usr/bin/env ruby | |
| require 'socket' | |
| test_file = ARGV[0] | |
| socket = UNIXSocket.new('testing.sock') | |
| socket.write(test_file) | |
| socket.close_write |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| (extend-type js/RegExp | |
| cljs.core/IFn | |
| (-invoke ([this s] (re-matches this s)))) | |
| (#"foo.*" "foobar") ;=> "foobar" | |
| (#"zoo.*" "foobar") ;=> nil | |
| (filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz") |
| // float->sRGB8 conversions - two variants. | |
| // by Fabian "ryg" Giesen | |
| // | |
| // I hereby place this code in the public domain. | |
| // | |
| // Both variants come with absolute error bounds and a reversibility and monotonicity | |
| // guarantee (see test driver code below). They should pass D3D10 conformance testing | |
| // (not that you can verify this, but still). They are verified against a clean reference | |
| // implementation provided below, and the test driver checks all floats exhaustively. | |
| // |
| // float->half variants. | |
| // by Fabian "ryg" Giesen. | |
| // | |
| // I hereby place this code in the public domain, as per the terms of the | |
| // CC0 license: | |
| // | |
| // https://creativecommons.org/publicdomain/zero/1.0/ | |
| // | |
| // float_to_half_full: This is basically the ISPC stdlib code, except | |
| // I preserve the sign of NaNs (any good reason not to?) |
| // half->float variants. | |
| // by Fabian "ryg" Giesen. | |
| // | |
| // I hereby place this code in the public domain. | |
| // | |
| // half_to_float_fast: table based | |
| // tables could be done in a more compact fashion (in particular, can store tab2 in low word of tab1!) | |
| // but something of a dead end since not very SIMD-friendly. pretty much abandoned at this point. | |
| // | |
| // half_to_float_fast2: use FP adder hardware to deal with denormals. |
| # Update, upgrade and install development tools: | |
| apt-get update | |
| apt-get -y upgrade | |
| apt-get -y install build-essential | |
| apt-get -y install git-core | |
| # Install rbenv | |
| git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
| # Add rbenv to the path: |