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 git { | |
for arg | |
do | |
if [[ $arg == -m* || $arg == -[^-]*m* ]] | |
then | |
annoy_me | |
return 1 | |
fi | |
done | |
command git "$@" |
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
Map vals = ['Zero':0, 'Negative decimal':-0.01, 'Negative decimal':-0.05, 'Negative whole number':-1, | |
'Negative decimal':-1.5, 'One':1, 'Positive decimal':0.01, 'Positive decimal':0.05, | |
'Positive decimal':1.5, 'Empty string':'', 'Empty list':[], 'Empty hash':[:], | |
'Lower character':'a', 'Upper character':'A', 'Null':null | |
] | |
vals.each{ k, v -> | |
println (v ? "$k ( $v ) is true" : "$k ( $v ) is 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
def vals = [50, 25, 5, 0, -5, -25, 50] | |
vals.each{ | |
println "\n\nVal is $it" | |
int i = 50 | |
i =- it | |
println "(50 =- $it) is equal to $i" | |
i = 50 |
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
def binding = new Binding() | |
def shell = new GroovyShell(binding) | |
def script = '''println "hello world" ''' | |
shell.evaluate(script) |
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 com.infinum | |
import java.sql.Types | |
import org.hibernate.dialect.MySQL5Dialect | |
import org.hibernate.type.StandardBasicTypes | |
class InfinumMysqlDialect extends MySQL5Dialect { | |
InfinumMysqlDialect () { | |
super () |
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
// | |
// data | |
// | |
def values = """821;1529;56 | |
733;1530;56 | |
749;1533;56 | |
728;1534;56""" | |
// | |
// code |
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
Date enddate = new Date() | |
Date startdate = enddate - 20 | |
//headers | |
println "Date - Year - Quarter - Month - Month - Month - WeekOfYear - WeekOfMonth - DayInYear - DayInMonth - DayInWeek - DayInWeek - DayInWeek - Weekday/Weekend" | |
//loop through each day | |
(startdate..enddate).each{ day -> | |
//Is this a weekend or a weekday? | |
def weekendStatus = 'Weekday' |
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
File file = new File("/tmp/time.csv") | |
//headers | |
file.append "key; hh:MMxm; HH:MM; hh; HH; MM; ampm;\n" | |
int key = 0 | |
(0..23).each{ hour -> | |
String ampm = "am" | |
String upperHString = String.format('%02d', hour) |
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
/* | |
* motorolaDate.groovy | |
* Renames photos taken by Droid X Cameras into something | |
* more sortable and useful. | |
* | |
* runs with groovy http://groovy.codehaus.org/ | |
* | |
* Download, edit the dirName variable, and then run: | |
* groovy motorolaDate.groovy | |
* The script will create sub-directories by year and month. |
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 factory; | |
import java.util.List; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import com.google.common.collect.Lists; | |
import transferobject.TransferObject; |
OlderNewer