<script type="text/javascript">
window.onload = function() {
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "http://stutostu.qiniudn.com/app.js";
document.getElementsByTagName("body")[0].appendChild(js);
20:10 dat-gitter-bot> (scriptjs) @mafintosh can you contrast hyperlog vs hypercore for their log capabilities, you dropped hypercore at some point. Is hypercore by itself as useful for an append only log use case? | |
20:10 <•mafintosh> @scriptjs right | |
20:10 <•mafintosh> so hyperlog is a DAG structure (a merkle dag even) | |
20:10 <•mafintosh> where data you insert can point to other data you insert | |
20:10 <•mafintosh> which is really great if you have multiple peers collaborating on the same data structure | |
20:11 <•mafintosh> a hyperlog is also always fully replicated since that makes the replication protocol pretty trivial | |
20:11 <•mafintosh> (i really need to write some white paper on that at some point) | |
20:11 <•mafintosh> hypercore is just simple single-writer append-only logs | |
20:11 <•mafintosh> so abstraction-wise hyperlog > hypercore | |
20:12 <•mafintosh> we could even make hyperlog run on top of hypercore which i really wanna do |
(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.
A quick overview of the node.js streams interface with basic examples.
This is based on @brycebaril's presentation, Node.js Streams2 Demystified
Streams are a first-class construct in Node.js for handling data.
Think of them as as lazy evaluation applied to data.
Lets look at how Facades work in Laravel 4 by investigating the flow of one of the facaded classes: URL. As in <?=URL::route('news')?>
.
As you'll see in the summary, this isn't exactly described in the procedural order your app is executed. But I think it serves to explain what's going on.
-
The app config has an
aliases
array. In there is:'URL' => 'Illuminate\Support\Facades\URL'
. If you look up that class, you'll see it just has this:protected static function getFacadeAccessor() { return 'url'; }
and that it inherits fromIlluminate\Support\Facades\Facade
. We'll get back to this later. -
Lets now turn to how the app boots up. The /vendor/laravel/framework/src/Illuminate/Foundation/start.php bootstrap file calls
registerAliasLoader()
on an instance ofIlluminate\Foundation\Application
.
// requirejs config in main.js | |
require.config({ | |
paths: { | |
jquery: 'components/jquery/jquery', | |
es5shim: 'components/es5-shim/es5-shim', | |
es5sham: 'components/es5-shim/es5-sham' | |
}, | |
map: { | |
'*': { | |
'flight/component': 'components/flight/lib/component', |
({:username "imakewebthings", | |
:name "Caleb Troughton", | |
:language "JavaScript", | |
:score 5476.8} | |
{:username "flyerhzm", | |
:name "Richard Huang", | |
:language "Ruby", | |
:score 2776.2} | |
{:username "fredwu", | |
:name "Fred Wu", |
王 | |
江 | |
周 | |
胡 | |
刘 | |
李 | |
吴 | |
毛 | |
温 | |
习 |
import urllib2 | |
def xiami_decode(s): | |
s = s.strip() | |
if not s: | |
return False | |
result = [] | |
line = int(s[0]) | |
rows = len(s[1:]) / line | |
extra = len(s[1:]) % line |