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
rules = [ | |
{ divisor: 3, word: "fizz" } | |
{ divisor: 5, word: "buzz" } | |
] | |
fizzBuzz = (n) -> | |
say = "" | |
say += i.word for i in rules when n % i.divisor is 0 | |
say || 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
// This file contains 3 lines of code | |
public interface Dave { | |
/** | |
* count the number of lines in a file | |
*/ | |
int countLines(File inFile); // not the real signature! | |
} |
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
/***** | |
* This is a test program with 5 lines of code | |
* \/* no nesting allowed! | |
//*****//***/// Slightly pathological comment ending... | |
public class Hello { | |
public static final void main(String [] args) { // gotta love Java | |
// Say hello | |
System./*wait*/out./*for*/println/*it*/("Hello/*"); | |
} |
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
suits = ["Hearts", "Diamonds", "Clubs", "Spades"] | |
cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"] | |
class Card | |
constructor: (value, suit) -> | |
@suit ?= suits[random(4)] | |
@value ?= cards[random(13)] | |
toString: -> | |
"#{@value} of #{@suit}" |
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
cards = ["2", "3", "4"] # etc... | |
suits = ["hearts", "spades"] # etc... | |
array = (a+b for a in cards for b in suits) | |
alert array |
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 selenium import webdriver | |
from selenium.common.exceptions import TimeoutException | |
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 | |
import time | |
# Create a new instance of the Firefox driver | |
driver = webdriver.Firefox() | |
# go to the google home page | |
driver.get("http://www.google.com") |
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
#!/bin/sh | |
#dropbox service | |
DROPBOX_USERS="user1 user2" | |
DAEMON=.dropbox-dist/dropbox | |
start() { | |
echo "Starting dropbox..." | |
for dbuser in $DROPBOX_USERS; do | |
HOMEDIR=`getent passwd $dbuser | cut -d: -f6` |
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
rubycsv.txt | |
=== | |
first, last, country | |
Yukihiro, Matsumoto, Japan | |
Bruce, Tate, USA | |
animals.txt | |
=== | |
one, two | |
lions, tigers |
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
The term 'invisible deficit' comes from the introduction to Taylor's | |
"Principles of Scientific Management": | |
"We can see and feel the waste of material things. Awkward, inefficient, or | |
ill-directed movements of men, however, leave nothing visible or tangible | |
behind them. Their appreciation calls for an act of memory, an effort of the | |
imagination. And for this reason, even though our daily loss from this source | |
is greater than from our waste of material things, the one has stirred us | |
deeply, while the other has moved us but little." |
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
"A human being should be able to change a diaper, plan an invasion, | |
butcher a hog, conn a ship, design a building, write a sonnet, | |
balance accounts, build a wall, set a bone, comfort the dying, | |
take orders, give orders, cooperate, act alone, solve equations, | |
analyze a new problem, pitch manure, program a computer, cook a tasty meal, | |
fight efficiently, die gallantly. Specialization is for insects." | |
-- Robert Heinlein, 'Time Enough for Love', 1973. |
OlderNewer