A simple demo of boltdb.
Compare prefix and range scans with the levelup approach described in the Rod Vagg's article, LevelDB and Node: Getting Up and Running.
See also the intro articles/talks by ...
extern crate tokio_core; | |
extern crate hyper; | |
extern crate futures; | |
use futures::Future; | |
use futures::future::ok; | |
use hyper::{Body, Client, Get, StatusCode}; | |
use hyper::client::HttpConnector; | |
use hyper::header::ContentLength; |
// 2018.5.11更新: 减少了swap | |
function qSort(compare) { | |
var swap = (p1, p2) => { | |
var tmp = this[p1]; | |
this[p1] = this[p2]; | |
this[p2] = tmp; | |
} | |
var sortRange = (start, end) => { | |
var midValue = this[start]; | |
var p1 = start + 1, p2 = end - 1; |
// from c++ version: https://gist.github.com/timshen91/f6a3f040e5b5b0685b2a | |
// author: wangxiaochi | |
function ConcatExpr (Left,Right) {this.Left = Left;this.Right=Right} // ab | |
function AltExpr(Left,Right) {this.Left = Left;this.Right=Right} // a|b | |
function RepeatExpr(SubExpr) {this.SubExpr= SubExpr;} // a* | |
function OptionalExpr(SubExpr) {this.SubExpr= SubExpr;} // a? | |
function MatchExpr(ch) { | |
this.ch= ch | |
} |
extern crate hyper; | |
extern crate url; | |
static HOST: &'static str = "www.google.com"; | |
macro_rules! ret_err( | |
($e:expr) => {{ | |
match $e { | |
Ok(v) => v, | |
Err(e) => { println!("Line {}: {}", line!(), e); return; } |
A simple demo of boltdb.
Compare prefix and range scans with the levelup approach described in the Rod Vagg's article, LevelDB and Node: Getting Up and Running.
See also the intro articles/talks by ...
from: http://play.golang.org/p/P5DDZrcXZB | |
package main | |
import "fmt" | |
type Monad interface { | |
Bind(func(interface{}, Monad) Monad) Monad | |
Return(interface{}) Monad | |
} |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"regexp" | |
"strings" | |
) |
This began as a further attempt to implement the Maybe monad in C++, but quickly spiralled out of control and now includes an implementation of the List monad as well (using std::list!). This is really for my own amusement rather than to try and do anything useful with them. It also gave me an excuse to try out C++ 11 lambda functions for the first time.
My original implementation defined a macro called MBind
which caused a number
of problems -- thankfully [PJayB][pjayb] managed to find a way around that so
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
" install vundle first: | |
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
set hidden | |
set nocompatible " do not compatible with vi | |
set backspace=indent,eol,start " allow backspace to delete char | |
set modeline | |
set shiftwidth=4 " set tab width to 4 space | |
set tabstop=4 | |
set expandtab |