Skip to content

Instantly share code, notes, and snippets.

View kellegous's full-sized avatar

Kelly Norton kellegous

View GitHub Profile
@kellegous
kellegous / wut.php
Last active September 10, 2015 23:50
<?php
function foo() {
try {
throw new Exception("ex1");
} finally {
try {
throw new Exception("ex2");
} catch (Exception $e) {
printf("caught in finally message=%s\n", $e->getMessage());
}
class Api_Resource_Public_Taxonomy_Node implements Api_ResourceSpec_ITyped {
const DESC = "A node in the taxonomy of items on Etsy";
use Api_ResourceSpec_Typed;
use Api_ResourceSpec_Declaration;
/**
* @var array
*/
class A[U <: String, V <: Int] {
def foo(u: U) = 1
def foo(v: V) = 2
}
public Stream<Verse> allVerses() {
return books().stream().reduce(
Stream.empty(),
(sa, b) -> b.chapters().stream().reduce(
sa,
(sb, ch) -> Stream.concat(sb, ch.verses().stream()),
(sb, sc) -> Stream.concat(sb, sc)),
(sb, sc) -> Stream.concat(sb, sc));
}
class Bucket {
let id : Int
init(id: Int) {
print("\(id) is upon us.")
self.id = id
}
deinit {
print("\(id) has left the building.")
x = True
while x:
print('forever')
while x == True:
print('forever')
y = 2
while y == 2:
print('forever')
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print('my list has this many in it')
print(len(a))
for i in a:
print(i)
#!/usr/bin/env python3
def parse_num(str):
return 42
print(parse_num('10000000000'))
#!/usr/bin/env python3
def parse_num(str):
return 42
for i in range(100):
print(parse_num(str(i)))
#!/usr/bin/env python3
def parse_num(str):
return 42
print(parse_num("42"))
print(parse_num("butter"))
print(parse_num("5444"))