Skip to content

Instantly share code, notes, and snippets.

View learner-long-life's full-sized avatar

Paul Pham learner-long-life

View GitHub Profile
@learner-long-life
learner-long-life / google-type.css
Last active August 29, 2015 14:12
D3 analog clock from Eric Bullington
body { margin: 0; padding: 0; zoom: 1; }
h1, h2, p { margin: 0; padding: 0; }
.strike { text-decoration: line-through; }
.avatar img { width: 30px; height: 30px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; }
.caption { margin: 0 0 60px 20px; }
.caption a { font: 14px/16px 'Unica One', Helvetica, Arial, sans-serif; letter-spacing: .1em; color: #999; text-transform: uppercase; text-decoration: none; }
.caption a:hover { background-color: #ddd; }
public class FizzBuzz {
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
if (i % 3 == 0) {
System.out.println("fizz");
} else if (i % 5 == 0) {
System.out.println("buzz");
} else if ((i % 3 == 0) && (i % 5 == 0)) {
// First, checks if it isn't implemented yet.
// from http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
class Node
def initialize(data)
@left = nil
@right = nil
@data = data
end
def setLeft(leftChild)
@left = leftChild
<div id="first">
This is a first div
</div>
@learner-long-life
learner-long-life / gist:8057238
Created December 20, 2013 16:22
Supposed improvement in Python file-reading speed, submitted by one of my students
inputfile = open(filename)
#...
# I swear enumerate() makes this faster.
for i, line in enumerate(inputfile):
if readnext == True: # Previous line started with an '@'
# linescounted += 1 # For line count check.
for bp in line.rstrip():
if bp == 'G':
0xc4d410134bb9e5cd73079604cda6faeafe0e64c0
@learner-long-life
learner-long-life / ParityDockerGCP.md
Last active August 2, 2017 04:34
Parity in Docker on GCP

sudo docker run -d --entrypoint /parity/parity -p 8545:8545 -p 8080:8080 -p 8180:8180 -v "/opt/blockchain/parity-kovan:/root/.local" "ethcore/parity:master" --chain=kovan --no-warp --jsonrpc-interface all --jsonrpc-hosts all --jsonrpc-cors "*" --jsonrpc-apis web3,eth,net,parity,parity_accounts,traces,rpc,parity_set,personal --ui-interface all

sudo docker run -d --entrypoint /parity/parity -p 8545:8545 -p 8080:8080 -p 8180:8180 -v "/opt/blockchain/parity-kovan:/root/.local" "ethcore/parity:master" --chain=kovan --no-warp --jsonrpc-interface all --jsonrpc-hosts all --jsonrpc-cors "*" --jsonrpc-apis "web3,eth,net,parity,parity_accounts,traces,rpc,parity_set,personal" --ui-interface all ui

0xe800ba1d8da6345ba16f512681c75e736f77f9bd