This file contains 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
Douglas Adams - The Hitchhiker's Guide to the Galaxy -- 394 upvotes, 87 downvotes | |
George Orwell - 1984 -- 372 upvotes, 66 downvotes | |
Kurt Vonnegut - Slaughterhouse-Five -- 330 upvotes, 50 downvotes | |
Orson Scott Card - Ender's Game -- 273 upvotes, 62 downvotes | |
Aldous Huxley - Brave New World -- 268 upvotes, 39 downvotes | |
George R R Martin - A Game of thrones -- 265 upvotes, 48 downvotes | |
JRR Tolkien - The Hobbit -- 255 upvotes, 47 downvotes | |
Joseph Heller - Catch 22 -- 210 upvotes, 38 downvotes | |
George Orwell - Animal Farm -- 200 upvotes, 44 downvotes | |
Frank Herbert - Dune -- 189 upvotes, 33 downvotes |
This file contains 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 urllib2 | |
import json | |
# grab data | |
raw_data = urllib2.urlopen('http://www.reddit.com/r/books/comments/lol8l/time_for_a_new_reddits_favorite_books_thread/.json').read() | |
thread_data = json.loads(raw_data)[1] | |
toplevel_comments = thread_data['data']['children'] | |
# extract books, upvotes and downvotes | |
votes = dict() |
This file contains 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 sys | |
def can_make(word, letters): | |
""" Return True if <word> can be generated using only the letters in the | |
list <letters>. """ | |
if len(word) > len(letters): return False | |
l = letters[:] |
This file contains 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
from string import whitespace, punctuation | |
def shift(c, shift_by = 2): | |
if c in whitespace + punctuation: return c | |
upper_ord, lower_ord, c_ord = ord('A'), ord('a'), ord(c) | |
c_rel = (c_ord - lower_ord) if c_ord >= lower_ord else (c_ord - upper_ord) | |
offset = lower_ord if c_ord >= lower_ord else upper_ord | |
return chr(offset + (c_rel + shift_by) % 26) |
This file contains 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 string | |
from collections import deque | |
alphabet = string.ascii_lowercase | |
alphabet_deque = deque(alphabet) | |
alphabet_deque.rotate(-2) | |
rotated_alphabet = ''.join(alphabet_deque) | |
tbl = string.maketrans(alphabet, rotated_alphabet) | |
msg = 'a quick brown fox jumped over the lazy dog' |
This file contains 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 <algorithm> | |
#include <fstream> | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
bool can_make(string word, vector<char> letters); | |
int get_max_len(vector<string> words); |
This file contains 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
"use strict;"; | |
// You need htmlparser, soupselect and ent to run this. | |
// Install them from npm. | |
var http = require("http"); | |
var fs = require("fs"); | |
var path = require("path"); | |
var htmlparser = require("htmlparser"); | |
var select = require("soupselect").select; | |
var ent = require("ent"); |
This file contains 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 xmpp, time | |
FB_ID = '[email protected]' | |
PASS = 'password' | |
jid = xmpp.protocol.JID(FB_ID) | |
client = xmpp.Client(jid.getDomain(), debug=[]) | |
if not client.connect(('chat.facebook.com', 5222)): | |
raise IOError('could not connect to Facebook') |
This file contains 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
extern mod std; | |
use std::list::*; | |
pub fn last_box<T>(l: @List<T>) -> T { | |
match *l { | |
Nil => fail!(), | |
Cons(hd, @Nil) => hd, | |
Cons(_, tl) => last_box(tl) | |
} | |
} |
This file contains 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
def answer(): | |
return 42 |
OlderNewer