Skip to content

Instantly share code, notes, and snippets.

server {
listen 80;
server_name _;
location = /_health {
return 204;
}
}
module A
x = 1
class B
def get_x
A::x #HOW DO I GET x in this scope why is ruby confusing me
end
end
end
const mapDispatchToProps = (dispatch) => {
return {
mouseOver: (id) => dispatch(updateTmpFailureId(id)),
mouseOut: () => dispatch(resetTmpFailureId()),
cookbookClick: (stacktrace) => (failureId) => {
dispatch(updateActiveFailureId(failureId));
dispatch(updateActiveHostId(0));
dispatch(updateActiveStacktrace(stacktrace));
},
failingHostClick: (hostId, stacktrace) => {
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:
@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)
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'
int f = 0;
int g = 1;
for (int i = 0; i <= 15; i++)
{
StdOut.println(f);
f = f + g;
g = f - g;
}
var addTwo = function(x, y) {
if (typeof(x) != "number" || typeof(y) != "number") {
//log it and bail
}
};
package db
import (
"fmt"
"github.com/eaigner/jet"
_ "github.com/lib/pq"
)
var (
Db *jet.Db
@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)