This file contains 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
/* | |
PutCallFlag: Either "put" or "call" | |
S: Stock Price | |
X: Strike Price | |
T: Time to expiration (in years) | |
r: Risk-free rate | |
v: Volatility | |
This is the same one found in http://www.espenhaug.com/black_scholes.html | |
but written with proper indentation and a === instead of == because it's |
This file contains 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
--- | |
# ^^^ YAML documents must begin with the document separator "---" | |
# | |
#### Example docblock, I like to put a descriptive comment at the top of my | |
#### playbooks. | |
# | |
# Overview: Playbook to bootstrap a new host for configuration management. | |
# Applies to: production | |
# Description: | |
# Ensures that a host is configured for management with Ansible. |
This file contains 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
Promise = require 'bluebird' | |
co = require 'co' | |
# Callbacks | |
wait = (n, cb) -> | |
setTimeout -> | |
cb null, n | |
, 1000 |
This file contains 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
// Promise.all is good for executing many promises at once | |
Promise.all([ | |
promise1, | |
promise2 | |
]); | |
// Promise.resolve is good for wrapping synchronous code | |
Promise.resolve().then(function () { | |
if (somethingIsNotRight()) { | |
throw new Error("I will be rejected asynchronously!"); |
This file contains 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 main | |
func main() { | |
var c chan string | |
c <- "let's get started" // deadlock | |
<-c // deadlock | |
c := make(chan string) | |
close(c) | |
c <- "let's get started" // panic | |
val, open := <-c // val = zero, open = false |
This file contains 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
yield Promise.map data, (oneEvent)-> | |
eventModel = new Event oneEvent | |
eventModel.fetch().then (fromDB) -> | |
return do eventModel.save if not fromDB? | |
fromDB.save oneEvent |
This file contains 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
$ node index.js | |
[-isodate-] INFO init start | |
[-isodate-] INFO init end | |
123 |
This file contains 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
#!/bin/sh | |
set -e | |
# Code generated by godownloader. DO NOT EDIT. | |
# | |
usage() { | |
this=$1 | |
cat <<EOF | |
$this: download go binaries for apex/up |
This file contains 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
let data = _.flow( | |
_.groupBy('country_id'), | |
_.map( | |
_.flow( // city group by level | |
_.groupBy('city_id'), | |
_.map( | |
_.flow( // person group by level | |
_.groupBy('person_id'), | |
_.map(vals => { | |
return { |
This file contains 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 MakeArray(size) { | |
for (var i = 1; i <= size; i++) { | |
this.length = size; | |
this[i] = 0; | |
} | |
} | |
/* |
OlderNewer