| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
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
| 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
| task args | |
| args.map = [:] | |
| tasks.addRule("Pattern: <property>=<value>: Passes arguments to the scripts") { String taskName -> | |
| def match = taskName =~ /(.*?)=(.*?$)/ | |
| if(match){ | |
| args.map[match[0][1]] = match[0][2] | |
| task(taskName) << { | |
| println "Used to pass value ${match[0][2]} to args.map.${match[0][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
| /* | |
| Copyright (c) 2011 Andrei Mackenzie | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
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
| @groovy.lang.Grapes([ | |
| @groovy.lang.Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2') | |
| ]) | |
| import groovyx.net.http.* | |
| def http = new HTTPBuilder('https://maps.googleapis.com/maps/api/directions/') | |
| http.get(path: 'json', | |
| query: [ |
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 } } | |
| } |
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
| package groovyx.gaelyk | |
| import groovyx.gaelyk.logging.LoggerAccessor; | |
| import spock.lang.Specification | |
| import spock.lang.Unroll; | |
| import com.google.appengine.api.LifecycleManager; | |
| import com.google.appengine.api.NamespaceManager; | |
| import com.google.appengine.api.backends.BackendService; | |
| import com.google.appengine.api.blobstore.BlobstoreService; |
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/bin/env ruby | |
| # | |
| # Convert blogger (blogspot) posts to jekyll posts | |
| # | |
| # Basic Usage | |
| # ----------- | |
| # | |
| # ./blogger_to_jekyll.rb feed_url | |
| # | |
| # where `feed_url` can have the following format: |
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/bin/env ruby | |
| #/ Usage: <progname> [options]... | |
| #/ How does this script make my life easier? | |
| # ** Tip: use #/ lines to define the --help usage message. | |
| $stderr.sync = true | |
| require 'optparse' | |
| # default options | |
| flag = false | |
| option = "default value" |