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 / Cyclomatic complexity exceeds 20
Last active December 26, 2015 03:59
Cyclomatic complexity weirdness
package com.netflix.asgard
import spock.lang.Specification
import spock.lang.Unroll
@Unroll
class StylerSpec extends Specification {
void 'availability zone to style class'() {
expect:
@tomaslin
tomaslin / gist:6469591
Created September 6, 2013 20:33
Deploy grails on cloudfoundry v2
gvm install grails 2.3.0.RC2
grails create-app testApp
cd testApp
cf login [email protected] --password somethingsomethingsomething
cf push --buildpack=https://github.com/heroku/heroku-buildpack-grails.git
@tomaslin
tomaslin / CTA Test
Created September 5, 2013 15:18
CTA Test code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title>Example</title>
<script type="text/javascript">
$(document).ready(function () {
var ctas = $('#ctas'),
ajaxResult = {
@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 {
@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 / 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
package com.example.helloworld;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@Produces(MediaType.APPLICATION_JSON)
public class HelloWorldService{
}
@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
role defined previously
User.createCriteria().list(){
createAlias( 'userRole', 'ur' )
and{
eq( 'role', 'ur.role' )
eq( 'ur.role', role )
}
projections{
property("username")
@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'