Skip to content

Instantly share code, notes, and snippets.

@chuckha
chuckha / some.md
Created January 21, 2014 21:20
so much markdown

Some Title

  1. first
  2. second
  3. third!
var worstFunctionEver = function (badArg) {
while (1) {
if (badArg == "hello") {
console.log("worst code ever");
}
}
}
@chuckha
chuckha / blastoff.swift
Created August 19, 2014 03:42
Straight up breaks the playground
func test() -> String {
func innerTest(n: Int) -> String {
if n == 0 {
return "Blast off"
}
return innerTest(n - 1)
}
return innerTest(10)
}
@chuckha
chuckha / yas.swift
Created August 20, 2014 04:24
yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas
func yas(numOfAs: Int) -> String {
var ret = "y"
for i in 1...numOfAs {
ret += "a"
}
return ret + "s"
}
yas(10)
package db
import (
"fmt"
"github.com/eaigner/jet"
_ "github.com/lib/pq"
)
var (
Db *jet.Db
var addTwo = function(x, y) {
if (typeof(x) != "number" || typeof(y) != "number") {
//log it and bail
}
};
int f = 0;
int g = 1;
for (int i = 0; i <= 15; i++)
{
StdOut.println(f);
f = f + g;
g = f - g;
}
All commands can be run with -h (or --help) for more information.
[cha@2518 ar2 (twitter-instagram)]$ rails s
=> Booting WEBrick
=> Rails 4.1.9 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/cha/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- instagram (LoadError)
from /Users/cha/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `block in require'
@chuckha
chuckha / Obama.txt
Created May 6, 2016 01:25
Thanks, Obama.
[cha@2518 ~]$ python collatz.py
Traceback (most recent call last):
File "collatz.py", line 25, in <module>
num_terations = collatz(i, 0)
File "collatz.py", line 16, in collatz
return collatz(lookup[start], iteration + 1)
File "collatz.py", line 12, in collatz
return collatz(lookup[start], iteration + 1)
File "collatz.py", line 12, in collatz
return collatz(lookup[start], iteration + 1)
lookup = {}
def collatz(start, iteration):
if start == 1:
return iteration + 1
if start in lookup:
return collatz(lookup[start], iteration + 1)
if start % 2 == 0:
lookup[start] = start / 2
return collatz(lookup[start], iteration + 1)
else: