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
@Test | |
public void shouldWorkAccordingToInstructions() { | |
//given (instructor is a mock injected in a worker) | |
given(instructor.getInstructions()).willReturn(particularInstructions); | |
//when (operate the SUT) | |
ParticularResult result = workerUnderTest.work(); | |
//then | |
then(instructor).should.getInstructions(); |
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
//make sure you understand what's happening here, you'll thank me some day | |
'foo' === 'bar' | |
false | |
'foo' === 'foo' | |
true | |
//watch out! | |
!'foo' === 'foo' | |
false |
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
# Get the binaries and move them to the right place | |
cd /tmp/ | |
wget http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-i686.tar.bz2 | |
tar xvjf phantomjs-1.7.0-linux-i686.tar.bz2 | |
mv phantomjs-1.7.0-linux-i686 /opt/ | |
# Make it available to Testacular | |
sudo ln -s /opt/phantomjs-1.7.0-linux-i686/bin/phantomjs /usr/local/bin/phantomjs | |
# If you don't want that symlink you can `export PHANTOMJS_BIN=/opt/phantomjs-1.7.0-linux-i686/bin/phantomjs` instead. |
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
git clone git://github.com/joyent/node.git | |
cd node | |
git checkout v0.8.14-release #latest version | |
./configure make sudo make install | |
#Confirm with | |
node -v | |
npm -v. |
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
junitReporter = { | |
// will be resolved to basePath (in the same way as files/exclude patterns) | |
outputFile: 'test-results.xml' | |
}; |
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 iron_worker import * | |
//you could read this from a file or stdin if you're not too lazy | |
payload = {'herokuping':{'hosts': ['comma-separated-hosts.com', 'another.net']}} | |
worker = IronWorker(config='config.ini') | |
name = "heroku-pinger" | |
zipFile = IronWorker.createZip(files=["herokuping_worker.py"], | |
destination="herokuping_worker.zip", overwrite=True) |
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
//there's an argument payload that gets a json file passed in containing the hosts | |
args = parser.parse_args() | |
hosts = False | |
if args.payload is not None: | |
payload = json.loads(open(args.payload).read()) | |
if 'herokuping' in payload: | |
hosts = (payload['herokuping']['hosts']) |
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
object LinearFit { | |
def through (points : (Double,Double)*) : (Double, Double) = { | |
val (xTotal,yTotal) = ((0.0,0.0) /: points) { case ((xA, yA), (x, y)) => (xA + x, yA + y) } | |
val (xAverage, yAverage) = (xTotal / points.size , yTotal / points.size) | |
val (squareSumXX, squareSumXY) = ((0.0,0.0) /: points) { | |
case ((ssxx, ssxy), (x, y)) => (ssxx + pow(x - xAverage, 2), | |
ssxy + (x - xAverage) * (y - yAverage)) | |
} | |
val b = (squareSumXY / squareSumXX) | |
(yAverage - b * xAverage, b) |
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
LinearFit through (Histogram of hitTimes) |
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
LinearFit through ((0.0, 1.0), (1.0, 1.0), (2.0, 1.0)) must beEqualTo(1, 0) |
NewerOlder