Skip to content

Instantly share code, notes, and snippets.

View tomaslin's full-sized avatar

Tomás Lin tomaslin

  • Netflix
  • San Jose, CA
View GitHub Profile
@tomaslin
tomaslin / gist:1011989
Created June 7, 2011 10:15
A simple payment app
A simple payment app.
Your task is to implement a simple payment tracking system in Grails or your preferred framework.
Requirements:
- Accounts have a balance, name, email.
- Every user starts off with £200.
- We would like to see proper use of tests, gsp tags and clean code.
- Don't worry about putting in a proper user management or security layer.
@tomaslin
tomaslin / gist:1028037
Created June 15, 2011 20:33
Cloud Foundry deployment hell
blah:se tomaslin$ grails -Dgrails.env=cf cf-update
...
Updating Application:
Checking for available resources:
Error: 500 Internal Server Error
blah:se tomaslin$ grails -Dgrails.env=cf cf-update
...
Updating Application:
Checking for available resources: OK
@tomaslin
tomaslin / Pivotal CSV to Trello.groovy
Created October 4, 2011 15:56
This is a groovy file ( http://groovy.codehaus.org/ ) that will import your Pivotal Tracker stories into your Trello board. It works with an empty board and will add stories to the first list.
@Grapes([
@Grab("org.codehaus.geb:geb-core:0.6.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.4.0"),
@Grab("net.sf.opencsv:opencsv:2.0")
])
import geb.Browser
import au.com.bytecode.opencsv.*
def fileLocation = 'secret_escapes_20111004_1436.csv' // the location of your csv file. You can go to your pivotal board and do an export to CSV.
@tomaslin
tomaslin / ConvertUiPerformanceTagLib.groovy
Created October 7, 2011 15:31
Mapping UI-performance tags to resources tags
package com.flashsales.utils
// maps UI Performance tags to resources plugin tags
class ConvertUiPerformanceTagLib {
static namespace = 'p'
def css = { attrs ->
attrs.uri = "/css/${ attrs.remove( 'name' ) }.css"
attrs.type = 'css'
role defined previously
User.createCriteria().list(){
createAlias( 'userRole', 'ur' )
and{
eq( 'role', 'ur.role' )
eq( 'ur.role', role )
}
projections{
property("username")
@tomaslin
tomaslin / gist:4051664
Created November 10, 2012 16:48
Deploying your grails app to appfog
Get a free appfog account at http://www.appfog.com
Install the gem
sudo gem install af
Go to your app directory
1. Create a war file
grails war
package com.example.helloworld;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldService{
}
@tomaslin
tomaslin / gist:5503539
Created May 2, 2013 16:45
Amadeus is spamming me. WTF?
Plano de viagem para : Kalil Lima
Plano de viagem para : Sra. Camila Silva
Plano de viagem para : Sr. Lucas Salomao
Motivo da viagem : .
Valor estimado da viagem : 4155.03 BRL
Reserva : Y9E44L
Código(s) de reserva do voo
Amadeus : Y9E44L
@tomaslin
tomaslin / ratpack doc
Created August 15, 2013 20:41
Iterate through all ratpack public specs and list contents
def output = new File('allTests.txt')
output.write('')
new File( System.getProperty("user.dir") ).eachDirRecurse{
if( it.name == 'test' ){
it.eachDirRecurse{ testDir ->
if( !testDir.absolutePath.contains( 'internal' ) && !testDir.absolutePath.contains('ratpack-test-support') ){
testDir.eachFile{ file ->
if( file.name.endsWith('Spec.groovy') ){
@tomaslin
tomaslin / All Ratpack external tests
Last active December 21, 2015 03:48
Ratpack tests from ratpack/ratpack Aug 15
********************************************************************************
ratpack/ratpack-core/src/test/groovy/org/ratpackframework/block/BlockingSpec.groovy
********************************************************************************
class BlockingSpec extends RatpackGroovyDslSpec {
def "can perform blocking operations"() {
when:
def steps = []
app {
handlers {
get {