Skip to content

Instantly share code, notes, and snippets.

function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
#!/usr/bin/env bash
#
# Wraps curl with a custom-drawn progress bar. Use it just like curl:
#
# $ curl-progress -O http://example.com/file.tar.gz
# $ curl-progress http://example.com/file.tar.gz > file.tar.gz
#
# All arguments to the program are passed directly to curl. Define your
# custom progress bar in the `print_progress` function.
#
#!/bin/bash
##########################################################
## Simple script to get maven dependency tree ##
## @author Lee, SeongHyun (Kevin) ##
## @veraion 0.0.1 (2013-01-17) ##
## ##
## To change the option 'include' and 'output', change ##
## the values of INCLUDE_NAME and OUTPUT_NAME ##
## respectively. ##
## e.g.) to change 'include' to 'inc' and 'output' to ##
var http = require('http');
var graceTimeout1 = 1;
var graceTimeout10 = 10;
var graceTimeout100 = 100;
var graceTimeout1000 = 1000;
process.on('SIGINT', function() {
console.log('SIGINT received');
extern clear, fillRect, renderLine, print;
struct Vec2d {
function void Vec2d(float x, float y) {
this->x = x;
this->y = y;
}
float x;
package net.gageot.phantomlenium;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.common.io.Resources;
import java.io.File;
import java.io.FileOutputStream;
// In Chrome Canary, with Experimental JavaScript enabled...
(function( exports ) {
// Create a reusable symbol for storing
// Emitter instance events
var sym = new Symbol();
function Emitter() {
this[ sym ] = {
#!/usr/bin/env node
var fs = require('fs');
var help = "Usage : trash [-lhx] files...\n\t-l : list trashcan\n\t-x : cancel (files: timestamp)\n\t-h : help";
var trash = process.env['HOME'] + "/.trash/";
(function(argv, log, error) {
argv = require('optimist').parse(argv);
if (typeof argv.l === 'string') {
@odyss009
odyss009 / Readme.md
Created April 21, 2013 13:58 — forked from NV/Readme.md

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')