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
package net.gageot; | |
import org.junit.Test; | |
import static org.fest.assertions.Assertions.assertThat; | |
public class CodeStoryStatusTest extends PhantomJsTest { | |
@Override | |
public String defaultUrl() { | |
return "http://status.code-story.net"; |
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
package net.gageot; | |
import org.junit.Test; | |
import static org.fest.assertions.Assertions.assertThat; | |
public class PhantomJsTest extends AbstractPhantomJsTest { | |
public String defaultUrl() { | |
return "http://www.bing.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
package net.gageot; | |
import org.fluentlenium.core.FluentAdapter; | |
import org.junit.AfterClass; | |
import org.junit.Before; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.phantomjs.PhantomJSDriver; | |
import org.openqa.selenium.phantomjs.PhantomJSDriverService; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.service.DriverService; |
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/bash | |
lines_to_skip=`t timeline | wc -l | sed 's/^ *//g'` | |
i=0 | |
echo Skipping [$lines_to_skip] lines in the timeline | |
echo From now on, say each tweet as soon as it arrives... | |
t stream timeline | while read -r line; do |
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/bash | |
function alert_user { | |
echo "${1}" | |
which -s growlnotify && growlnotify `basename $0` -m "${1}" | |
} | |
function exit_ko { | |
alert_user "${1}"; exit 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
package fr.xebia.katas.gildedrose; | |
@lombok.AllArgsConstructor | |
class ItemUpdater { | |
@lombok.Delegate Item item; | |
void updateQuality() { | |
setSellIn(getSellIn() - ("Sulfuras, Hand of Ragnaros".equals(getName()) ? 0 : (("Aged Brie".equals(getName()) && updateQuality(getQuality() + 1 + (getSellIn() <= 0 ? 1 : 0))) || ("Backstage passes to a TAFKAL80ETC concert".equals(getName()) && updateQuality(getSellIn() <= 0 ? 0 : (getQuality() + 1 + (getSellIn() <= 10 ? 1 : 0) + (getSellIn() <= 5 ? 1 : 0)))) || ("Conjured Mana Cake".equals(getName()) && updateQuality(getQuality() - 2 - (getSellIn() <= 0 ? 2 : 0))) || updateQuality(getQuality() - 1 - (getSellIn() <= 0 ? 1 : 0)) ? 1 : 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
Origin replaceDigit = method(case(self, | |
or(3,"3"), "Foo", | |
or(5,"5"), "Bar", | |
or(7,"7"), "Qix", | |
"" | |
)) | |
forMultiples = fn(n, | |
[3,5,7] filter(div, (n%div) == 0) map(replaceDigit) | |
) |
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("ispec") | |
iter = method(chars,height,offY,offX, | |
(height == 1) ifTrue( | |
chars[offY][offX] = "\u25B2", | |
) ifFalse( | |
height /= 2 | |
iter(chars,height,offY+height,offX-height) | |
iter(chars,height,offY,offX) | |
iter(chars,height,offY+height,offX+height) |
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
;Response to challenge at http://beust.com/weblog/2011/10/30/a-new-coding-challenge/ | |
N = 40 | |
combinations = for( | |
a <- 1..N-3, | |
b <- a..N-3, | |
c <- b..N-3, | |
d <- c..N-3, | |
a+b+c+d == 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
# sudo gem install watchr growl | |
# | |
# Run me with: | |
# $ watchr watch.txt | |
# | |
require 'growl' | |
watch('.*\.m') {test} | |
watch('.*\.h') {test} | |
watch('IpadCorporate.xcodeproj/.*') {test} |