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 foo() { | |
return 1; | |
} | |
char foo() { | |
return 'c'; | |
} | |
int main() { | |
foo(); |
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
# why this | |
if foo in bar: | |
something = True | |
else: | |
something = False | |
# and not this | |
something = foo in bar |
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
import java.util.Vector; | |
import java.util.Random; | |
class BitCountTest { | |
// From Java 1.5+ | |
public static int bitCountJava(int i) { | |
i = i - ((i >>> 1) & 0x55555555); | |
i = (i & 0x33333333) + ((i >>> 2) & 0x33333333); | |
i = (i + (i >>> 4)) & 0x0f0f0f0f; | |
i = i + (i >>> 8); |
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
import json | |
import sys | |
import time | |
import urllib2 | |
nodes = ["307035796257525760"] | |
max_branches = 2 | |
sleep = 1 | |
nodes_done = [] |
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
bool for_switch_state_machine_wtf() { | |
int state = 1 | |
for(;;) { | |
switch(state) { | |
case 1: | |
if (!do_some_stuff()) | |
return false; | |
state = 2; |
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
"""Convert decimal numbers to pinary (base pi). | |
Fractional and even irrational bases are possible, but aren't really useful for | |
anything. Base pi has four digits: 0, 1, 2, and 3. What's interesting is that | |
there's some "space" between the highest digit and the base, which means that | |
there are numbers with multiple valid representations. You'll notice: | |
decimal 7.000000 = pinary 20.2021120021 | |
decimal 8.000000 = pinary 21.2021120021 | |
decimal 9.000000 = pinary 22.2021120021 |
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
Current ballot counts: <http://mlb.mlb.com/news/article.jsp?ymd=20130603&content_id=49475890> | |
Current batting WAR: <http://www.baseball-reference.com/leagues/AL/2013-value-batting.shtml#players_value_batting::15> | |
Current pitching WAR: <http://www.baseball-reference.com/leagues/AL/2013-value-pitching.shtml#players_value_pitching::18> | |
POS NAME CURRENT PLACE IN VOTING | |
1B: Chris Davis 1 | |
2B: Dustin Pedroia 3 | |
SS: Jhonny Peralta 3 | |
3B: Manny Machado 2 | |
OF: Coco Crisp 13 |
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
#include <stdio.h> | |
int main() { | |
printf("1111111111111111 = %.0f\n", 1111111111111111.0); | |
printf("11111111111111111 = %.0f\n", 11111111111111111.0); | |
printf("111111111111111111 = %.0f\n", 111111111111111111.0); | |
printf("1111111111111111111 = %.0f\n", 1111111111111111111.0); | |
printf("11111111111111111111 = %.0f\n", 11111111111111111111.0); | |
printf("111111111111111111111 = %.0f\n", 111111111111111111111.0); | |
return 0; |
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
Generation 0: Parents 0.000% and 0% ethnic had a child 0.000% ethnic | |
Generation 1: Parents 0.000% and 100% ethnic had a child 50.000% ethnic | |
Generation 2: Parents 50.000% and 0% ethnic had a child 25.000% ethnic | |
Generation 3: Parents 25.000% and 100% ethnic had a child 62.500% ethnic | |
Generation 4: Parents 62.500% and 0% ethnic had a child 31.250% ethnic | |
Generation 5: Parents 31.250% and 100% ethnic had a child 65.625% ethnic | |
Generation 6: Parents 65.625% and 0% ethnic had a child 32.812% ethnic | |
Generation 7: Parents 32.812% and 100% ethnic had a child 66.406% ethnic | |
Generation 8: Parents 66.406% and 0% ethnic had a child 33.203% ethnic | |
Generation 9: Parents 33.203% and 100% ethnic had a child 66.602% ethnic |
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
import json | |
import re | |
import urllib | |
import urllib2 | |
from time import sleep | |
comments = 0 | |
missing = [] | |
csv = open('super-bowl-comments.csv', 'w') |