Skip to content

Instantly share code, notes, and snippets.

View ethnt's full-sized avatar
🐢

Ethan Turkeltaub ethnt

🐢
View GitHub Profile
@ethnt
ethnt / citeproc
Last active January 1, 2016 15:59
http://rubydoc.info/gems/citeproc-ruby
[1] pry(main)> require 'unicode_utils'
=> true
[2] pry(main)> require 'citeproc'
=> true
[3] pry(main)> book = {
[3] pry(main)* 'author' => [{ 'given' => 'Edgar Allen', 'family' => 'Poe' }],
[3] pry(main)* 'title' => 'Poetry, Tales, and Selected Essays',
[3] pry(main)* 'type' => 'book',
function HelloWorld (name) {
this.name = name;
}
HelloWorld.prototype.sayHello = function() {
return "Hello there " + this.name;
}
var hi = new HelloWorld("Ethan");
hi.sayHello(); // => "Hello there Ethan"
@ethnt
ethnt / gist:7405897
Last active December 27, 2015 23:28 — forked from anonymous/gist:7405894

Randomness and Probability

  • Bernoulli trial: a random variable such that;
    1. Two possible outcomes, success and failure;
    2. Probability of success is always the same (P(success) = p);
    3. All trials are independent.

Examples:

  • fair coin (50% chance of heads and tails), heads = success, p = 1/2
function start(min_num, max_num) {
var min = min_num;
var max = max_num;
return result(min, max);
}
function guess(min_num, max_num) {
var guess = Math.floor((min + max) / 2);
@ethnt
ethnt / _rainbows.sass
Last active December 24, 2015 12:39
Make a rainbow border like on CreativeMornings.com.
@import compass/css3
// A lot of this is taken from Hugo Giraudel's post on CSS Tricks
// about this: http://css-tricks.com/striped-background-gradients/
// Create a rainbow-style border before or after an element.
//
// rainbows([$position, $size, $colors...])
@mixin rainbows($position, $size, $colors...)
$stripe-width: 100% / length($colors)
@ethnt
ethnt / gist:6575048
Created September 15, 2013 23:02
Cisco AnyConnect compaining.
Sep 15 00:30:14 tardis acwebsecagent[232]: OnConnectionFailure : Fail Open - Reason = Unable to verify the license key
Sep 15 00:30:14 tardis acwebsecagent[232]: Connection : Auth key is not provided or is invalid, applying connection failure policy. CMode : 2 TMode : 1
@ethnt
ethnt / gist:6059438
Created July 23, 2013 02:35
PostgreSQL
$ brew install postgresql

Do the launchctl stuff that Homebrew says to do.

$ initdb /usr/local/var/postgres
@ethnt
ethnt / gist:6040456
Created July 19, 2013 16:22
OS X bash profile. These are the very basics, without much configuration.
###
### .bash_profile
###
export PATH=/usr/local/bin:$PATH
# Get the aliases
source /Users/ethan/.bash_aliases
# Enable colors on the command line
@ethnt
ethnt / gist:5991241
Created July 13, 2013 16:30
Siteleaf CLI theme pull error.
$ siteleaf pull theme
/Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/net/http.rb:918:in `connect'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/open-uri.rb:313:in `open_http'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/open-uri.rb:708:in `buffer_open'
from /Users/ethan/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/open-uri.rb:210:in `block in open_loop'
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon