This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate diesel; | |
use diesel::{ | |
prelude::*, query_builder::{InsertStatement, UndecoratedInsertRecord}, | |
query_dsl::methods::ExecuteDsl, | |
}; | |
trait LoadTable { | |
type Insertable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "serde_test" | |
version = "0.1.0" | |
[dependencies] | |
serde = "0.9" | |
serde_json = "0.9" | |
serde_derive = "0.9" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(conservative_impl_trait, plugin)] | |
#![plugin(tarpc_plugins)] | |
extern crate futures; | |
#[macro_use] | |
extern crate tarpc; | |
extern crate tokio_core; | |
use app1::FutureServiceExt; | |
use app2::FutureServiceExt as F; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
fn main() { | |
// println!("{:?}", go(&[1, 2, 3])); | |
// println!("{:?}", go(&[1, 3, 4, 5, 6])); | |
println!("go_while {:?}", go_while(&[1, 3, -4, 4, 5, 6])); | |
println!("go_filter_map {:?}", go_filter_map(&[1, 3, 4, -4, 5, 6])); | |
let mut hm = HashMap::new(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
set hidden | |
filetype off " required | |
" line numbers | |
set number | |
set relativenumber | |
set backspace=2 "allow deleting any chars in insert mode | |
set laststatus=2 | |
set ruler " show the cursor position all the time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sma_original(avect, numPer) | |
numEle = length(avect) | |
tout = Array(Float32, numEle) | |
for ndx = 1:numEle | |
tsum = 0.0 | |
begndx = max(1, ndx - numPer) | |
for slicendx = begndx:ndx | |
tsum += avect[slicendx] | |
end | |
tout[ndx] = tsum / float32(numPer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tComment' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate collections; | |
use collections::HashMap; | |
struct Item { | |
id: int, | |
name: StrBuf, | |
} | |
fn build_hash(vec: Vec<Item>) -> HashMap<int, Item> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /Users/<user>/Library/Application Support/Sublime Text 2/Packages/User | |
# comment-param.sublime-snippet | |
<snippet> | |
<content><![CDATA[ | |
# @param [${1:class}] ${2:arg} - ${3:comment} | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>cprm</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = "" | |
, first_data = true | |
// message terminator | |
// all JSON requests will terminate with }} | |
, terminator = "}}"; | |
request = consumer.get(url, access_token, access_secret); | |
request.on("response", function (response) { | |
response.setEncoding("utf8"); |
NewerOlder