Skip to content

Instantly share code, notes, and snippets.

View intellecat's full-sized avatar
🌴
On vacation

geecat intellecat

🌴
On vacation
  • CatЯun
  • NZ
  • 13:51 (UTC +13:00)
View GitHub Profile
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

关于引入组件

1. 把代码放到页面head里面,自动加载

<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); 
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@joyrexus
joyrexus / README.md
Last active June 27, 2024 15:39
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@weotch
weotch / Laravel 4: Service Providers and Facades.md
Last active December 15, 2019 01:55
Laravel 4: Service Providers and Facades

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')?>.

The logic flow

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.

  1. 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 from Illuminate\Support\Facades\Facade. We'll get back to this later.

  2. 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 of Illuminate\Foundation\Application.

@mkuklis
mkuklis / gist:4712839
Last active December 12, 2015 04:18
requirejs+flight
// 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",
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词
@dndx
dndx / xiami_decode.py
Created April 29, 2012 14:42
Xiami URL Decoder
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