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
#!/usr/bin/env groovy | |
// Trying it in Groovy as a shell script (just for fun) | |
import java.util.regex.Pattern | |
// All folders on the path which have contents: | |
path = System.env[ 'PATH' ] | |
.tokenize( File.pathSeparator ) | |
.collect( { new File( it ) } ) |
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
// When this script it run, try typing some text into the textfield with | |
// spaces in it. Then click the button (it will print out the value in | |
// the backing model -- which is right), but the textField has the wrong | |
// value in it | |
import java.beans.* | |
import java.awt.BorderLayout as BL | |
import groovy.beans.Vetoable | |
import groovy.beans.Bindable | |
import groovy.swing.SwingBuilder |
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 in BootStrap.groovy | |
class BootStrap { | |
def dataService | |
def init = { servletContext -> | |
dataService.initBeans() | |
} | |
def destroy = { | |
} |
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
; Amaturish Clojure version of uniprot mapping function by @sjcockell | |
; http://blog.fuzzierlogic.com/archives/339 | |
; http://gist.github.com/329730 | |
(ns uniprot | |
(:use clojure.contrib.duck-streams) | |
(:import java.net.URLEncoder)) | |
(defn- url-encode | |
"Passes a String through java.net.URLEncoder.encode" | |
[ param ] (URLEncoder/encode param)) |
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
(ns user) | |
(defn- reverse-base [base] | |
(let [mapping { :A \T :T \A :G \C :C \G } | |
key (keyword (.toString base))] | |
(key mapping))) | |
(defn reverse-complement [sequence] | |
(let [rev-seq (reverse (.toUpperCase sequence))] | |
(map reverse-base rev-seq))) |
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 "are you thinking of an animal" game from over 2 decades ago, but in clojure | |
; Tim Yates | |
; v0.1 | |
; Not sure if storing the brain as a load of refs is the most ideomatic way of doing things | |
; Also, one of my first full bits of clojure, so might not be the most sensible way of doing | |
; any of it |
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
(function( $ ) { | |
var defaults = { | |
image : 'water.png', | |
damping : 4, | |
dripSize : 9, | |
dripDepth : 250 | |
}; | |
var options ; | |
var canvas ; | |
var top = 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
@Grab( 'org.fusesource.hawtdispatch:hawtdispatch:1.1' ) | |
import org.fusesource.hawtdispatch.* | |
import static org.fusesource.hawtdispatch.Dispatch.* | |
import java.util.concurrent.Semaphore | |
done = new Semaphore( 1 - ( 1000 * 1000 ) ) | |
queue = createQueue() | |
source = createSource EventAggregators.INTEGER_ADD, queue |
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
// Numerics to chars they represent | |
def mnemonics = [ | |
'2': 'ABC', | |
'3': 'DEF', | |
'4': 'GHI', | |
'5': 'JKL', | |
'6': 'MNO', | |
'7': 'PQRS', | |
'8': 'TUV', | |
'9': 'WXYZ' |
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
@Grab(group='org.codenarc', module='CodeNarc', version='0.15') | |
@Grab(group='net.sourceforge.nekohtml', module='nekohtml', version='1.9.15') | |
import org.codenarc.AnalysisContext | |
import org.codenarc.CodeNarc | |
import org.codenarc.CodeNarcRunner | |
import org.codenarc.analyzer.SourceAnalyzer | |
import org.codenarc.analyzer.StringSourceAnalyzer | |
import org.codenarc.report.TextReportWriter | |
import org.codenarc.ruleset.PropertiesFileRuleSetConfigurer | |
import org.codenarc.results.Results |
OlderNewer