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 | |
VERSION=$1 | |
if [ $VERSION = "2" ] | |
then | |
VERSION="2.0.0.M1" | |
fi | |
rm /opt/grails-current | |
ln -sf /opt/grails-$VERSION /opt/grails-current |
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 no.nsb.ombord; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.net.SocketTimeoutException; | |
import java.net.UnknownHostException; | |
import org.apache.http.util.ExceptionUtils; |
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=0 | |
while read line | |
do | |
$(echo $line | cut -d\; -f3 >> '/tmp/bash.txt') | |
let LINES=LINES+1 | |
done < "prior_notifications.csv" | |
echo LINES $LINES |
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 | |
# This is ~/.auto_grails_switch, and it switches your grails runtime. | |
# 1. add this file to the bottom of ~/.bashrc | |
# source ~/.auto_grails_switch.sh | |
# 2. Make sure .auto_grails_switch is run every time you change dir. add \$(auto_grails_switch) to PS1 | |
# PS1='debian_chroot:+($debian_chroot)}\$(auto_grails_switch)\$ ' |
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
/* | |
* Detects all scripts in DOM with src tag, and loads then into the html. | |
*/ | |
var HandlebarsSrcLoader = function() { | |
} | |
HandlebarsSrcLoader.prototype = { | |
load : function (callback) { | |
var thiz=this; | |
var callback=callback; |
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 | |
void "should be able to find follow up status"() { | |
//setup: | |
prepareMock() | |
//given | |
StatusInstance existing = insertStatusInstance() | |
//when | |
StatusCode followup = service.findFollowupStatus(existing.id.toString()) |
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
(defn strong? [person] (= (person :name) "Arnold")) | |
;#'user/strong? | |
(def people {"arnie" {:name "Arnold"} "joe" {:name "joe"}}) | |
;#'user/people | |
(filter strong? people) |
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
void "end jobs should leave no threads"() { | |
setup: | |
myService.startJobs() | |
when: | |
myService.endJobs() | |
Thread.sleep(300) | |
then: | |
Thread.getAllStackTraces().keySet().findAll \\ | |
{Thread thread -> thread.name.contains "Job"}.size() == 0 | |
} |
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
void "starting jobs creates threads"() { | |
when: | |
myService.startJobs() | |
Thread.sleep(300) | |
then: | |
Thread.getAllStackTraces().keySet().findAll \\ | |
{Thread thread -> thread.name.contains "Job"}.size() > 1 | |
cleanup: | |
myService.endJobs() //important, or you risk threads contaminating your next test. (happened to me) | |
} |
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 java.util.* | |
// very silly example spawning a thread | |
class MyService { | |
TimerTask task | |
Timer timer | |
def startJobs() { | |
timer = new Timer("Job") //Setting job name is important for the test | |
task = timer.runAfter(10000, {}) |
OlderNewer