Skip to content

Instantly share code, notes, and snippets.

Luca Barbato lu-zero

Block or report user

Report or block lu-zero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@glfmn
glfmn / .pre-commit.sh
Last active Sep 26, 2019
pre-commit Test Automation Script
View .pre-commit.sh
#!/usr/bin/env sh
# pre-commit.sh
STASH_NAME="pre-commit-$(date +%s)"
ROOT_DIR="$(git rev-parse --show-toplevel)"
BUILD_DIR="${ROOT_DIR}/target"
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
@Geal
Geal / gist:540ddd745045e7335c0d
Created Jan 14, 2015
create a closure depending on a parameter
View gist:540ddd745045e7335c0d
fn prod<'a,'b>(a:uint) -> Box<FnMut(&'b[u8]) -> &'b[u8] +'a> {
box move |&: input: &'b[u8]| -> &'b[u8] {
input.slice_from(a)
}
}
fn main() {
let mut a = prod(2);
println!("a1: {}", a("abcdefgh".as_bytes()));
// -> a1: [99, 100, 101, 102, 103, 104]
You can’t perform that action at this time.