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 evaluateNext(tokens): | |
first = tokens.pop(0) | |
if first == '(': | |
inner = [] | |
depth = 0 | |
while not (tokens[0] == ')' and depth == 0): | |
if tokens[0] == '(': | |
depth += 1 | |
if tokens[0] == ')': | |
depth -= 1 |
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 os | |
[os.system('javac ' + n[2:] + '; java ' + n[2:].strip('.java')) for n in os.popen('find -name "Test*.java"').read().split('\n') if n] |
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
// Simple Flappy Bird Clone | |
// Allen Guo <allenguo@berkeley.edu> | |
var SPAWN_INTERVAL = 15; | |
var GRAVITY = 1; // Accelerate toward bottom | |
var RECT_WIDTH = 50; | |
var RECT_VELOCITY = 10; | |
var PLAYER_X = 360; |
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
<!doctype html> | |
<html ng-app="toDoApp" ng-controller="toDoController"> | |
<head> | |
<title>Tasks App</title> | |
<script src="angular.js"></script> | |
<style> | |
body { | |
color: #444; | |
font-size: 14px; | |
font-family: "Roboto", sans-serif; |
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
<!doctype html> | |
<html ng-app="friendsApp" ng-controller="friendsController"> | |
<head> | |
<title>Friends</title> | |
<script src="angular.js"></script> | |
<style> | |
body { | |
color: #444; | |
font-size: 14px; | |
font-family: "Roboto", sans-serif; |
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 itertools, random | |
class Person: | |
def __init__(self, righthanded): | |
self.righthanded = righthanded | |
self.shakes = [] | |
def shake(self, partner): | |
if self.righthanded and partner.righthanded: |
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
Running 20 trials | |
----------------------------------------------------------------- | |
Starting trial 0 | |
20 right-handed people | |
19 left-handed people | |
Result: 0.745341614907 | |
Expected: 0.736842105263 | |
Percent error: 1.15350488021 | |
----------------------------------------------------------------- | |
Starting trial 1 |
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
{ | |
"cache-control": "public, s-maxage=86400, max-age=300", | |
"content-encoding": "gzip", | |
"content-language": "en", | |
"content-length": "26452", | |
"content-type": "text/html; charset=utf-8", | |
"date": "Sun, 06 Jul 2014 12:52:17 GMT", | |
"etag": "\"1404615811-0+gzip\"", | |
"expires": "Sun, 19 Nov 1978 05:00:00 GMT", | |
"last-modified": "Sun, 06 Jul 2014 03:03:31 +0000", |
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 requests | |
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36'} | |
LOGIN_URL = 'https://www.edline.net/InterstitialLogin.page' | |
LOGIN_POST_URL = 'https://www.edline.net/post/InterstitialLogin.page' | |
class Edline(object): |
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
#!/usr/bin/env python | |
""" | |
property_proposals_stats.py: Tabulates and exports statistics for proposed Wikidata properties. | |
Dependencies: | |
* Python (2.x) | |
* Requests (http://docs.python-requests.org/en/latest/) | |
Instructions: |