This file contains hidden or 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
$ grails create-app grails-blog | |
$ cd grails-blog | |
$ grails install-plugin simple-blog | |
$ cat >> grails-app/conf/Config.groovy | |
> grails.blog.author.evaluator = { request.remoteAddr } | |
> ^D | |
$ mkdir -p grails-app/domain/demo/blog/ | |
$ cat > grails-app/domain/demo/blog/Commenter.groovy | |
> package demo.blog | |
> |
This file contains hidden or 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
require 'rubygems' | |
require 'expectations' | |
Expectations do | |
expect(1){ proc{ |a| a }.call(1) } | |
expect([1, 2]){ proc{ |a| a }.call(1, 2) } | |
expect(1){ proc{ |a, b| a }.call(1, 2) } | |
expect(1){ Proc.new{ |a| a }.call(1) } |
This file contains hidden or 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 | |
/export/groups/nagios/libexec/check_http -f follow -H $1 -u /trainline -a tlsvn:\!4321abcd -r `/usr/bin/curl -u tlsvn:\!4321abcd -L http://bngsvn01.thoughtworks.co/trainline 2> /dev/null | /bin/sed -ne "/title.*Revision/ { s/.*trainline -Revision \([0-9]\+\):.*/\1/ ; p}"` |
This file contains hidden or 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
def f = new Foo('hello') | |
assert f.bar() == 'original hello' | |
use(FooCategory) { assert f.bar() == 'categorical hello' } | |
class Baz { | |
def quux(boo) { new Foo(boo).bar() } | |
} |
This file contains hidden or 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
foo = lambda { |x| puts x } | |
foo.call('Hello, World!') | |
foo['You can index me too!'] |
This file contains hidden or 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
({ it('ABCD') }) { "${it} and some more" } //=> 'ABCD and some more' |
This file contains hidden or 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
class BooleanCategory { | |
public static Boolean then(Boolean self, Closure c) { | |
if(self) c() | |
return self | |
} | |
public static Boolean otherwise(Boolean self, Closure c) { | |
if(!self) c() | |
return self |
This file contains hidden or 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/gnu/bin/sed -rf | |
s_\|\s*(\[\S+\s*)?([^\|]+)\]?\s*\|\|([^\|]+)\|\|.*_"\2" <\3>, _ | |
s_ "_"_g | |
s_]"_"_ | |
s_< _<_ | |
s_ >_>_ | |
s_\s*\(at\)\s*_@_g | |
s_\s*\(dot\)\s*_._g | |
s_\s*\[dot\]\s*_._g |
This file contains hidden or 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
# http://github.com/c42/goldberg/raw/master/Gemfile | |
source 'http://rubygems.org' | |
gem 'rails', '3.0.5' | |
gem 'sqlite3', '~> 1.3.3', :platforms => :ruby | |
gem 'haml', '~> 3.0.25' | |
platform :jruby do |
This file contains hidden or 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
enum OS { | |
DOS('PC DOS 2000 License'), WIN('Genuine Windows 7 Professional 32'); | |
private final String text | |
private OS(text) { this.text = text } | |
public static parseText(text) { OS.values().find { it.text == text } } | |
} |
OlderNewer