- first
- second
- third!
This file contains hidden or 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
| var worstFunctionEver = function (badArg) { | |
| while (1) { | |
| if (badArg == "hello") { | |
| console.log("worst code ever"); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| func test() -> String { | |
| func innerTest(n: Int) -> String { | |
| if n == 0 { | |
| return "Blast off" | |
| } | |
| return innerTest(n - 1) | |
| } | |
| return innerTest(10) | |
| } |
This file contains hidden or 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
| func yas(numOfAs: Int) -> String { | |
| var ret = "y" | |
| for i in 1...numOfAs { | |
| ret += "a" | |
| } | |
| return ret + "s" | |
| } | |
| yas(10) |
This file contains hidden or 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 db | |
| import ( | |
| "fmt" | |
| "github.com/eaigner/jet" | |
| _ "github.com/lib/pq" | |
| ) | |
| var ( | |
| Db *jet.Db |
This file contains hidden or 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
| var addTwo = function(x, y) { | |
| if (typeof(x) != "number" || typeof(y) != "number") { | |
| //log it and bail | |
| } | |
| }; |
This file contains hidden or 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
| int f = 0; | |
| int g = 1; | |
| for (int i = 0; i <= 15; i++) | |
| { | |
| StdOut.println(f); | |
| f = f + g; | |
| g = f - g; | |
| } |
This file contains hidden or 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
| 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' |
This file contains hidden or 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
| [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) |
This file contains hidden or 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
| 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: |