Skip to content

Instantly share code, notes, and snippets.

@rodrigoSaladoAnaya
rodrigoSaladoAnaya / BootStrap.groovy
Last active December 19, 2015 14:58
How to integrating Vert-x in Grails using a PlatformManager. (Test)
//grails-app/conf/BootStrap.groovy
import org.vertx.java.platform.PlatformLocator
class BootStrap {
def vertxPlatformManager
def init = { servletContext ->
vertxPlatformManager = PlatformLocator.factory.createPlatformManager()
URL[] classpath = [new File('./src/verticles').toURI().toURL()]
vertxPlatformManager.deployVerticle(
@samatjain
samatjain / Encrypted-Amazon-Cloud-Drive.md
Last active May 18, 2017 18:50
Setting up a encrypted drive on Amazon Cloud Drive w/ EncFS and acd_cli

Environment

export ACD_LOCAL=$HOME/.cache/Amazon-Cloud-Drive

# To use this file later
export ENCFS6_CONFIG=$ACD_LOCAL/encfs6.xml

Setup

mkdir -p \

@tlvenn
tlvenn / build.gradle
Created March 24, 2017 01:17 — forked from AndrewJack/build.gradle
React Native Android Library SDK Versions
subprojects {
ext {
compileSdk = 25
buildTools = "25.0.1"
minSdk = 19
targetSdk = 25
}
afterEvaluate { project ->
if (!project.name.equalsIgnoreCase("app")
@taichi
taichi / Watcher.java
Created April 27, 2012 11:02
example of java.nio.file.WatchService
package sandbox;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import java.io.IOException;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.FileSystem;
@squarepegsys
squarepegsys / resources.groovy
Created August 19, 2015 00:43
HikariCP in Grails
// Shameless stolen from http://stackoverflow.com/questions/25772324/defining-an-alternate-connection-pool-in-grails-2-3-6
def config = Holders.config
def dataSources = config.findAll {
it.key.toString().contains("dataSource_")
}
dataSources.each { key, value ->
def ds = value
@atbradley
atbradley / stripTags.groovy
Created April 28, 2011 14:22
Very simplistically remove HTML tags from strings.
public static String stripTags(String input) {
return input.replaceAll("\\<.*?>","");
}
@mathifonseca
mathifonseca / GRAILS - Assigned id for domains.md
Last active July 15, 2019 00:26
GRAILS - Assigned id for domains

If you have a Domain class with an assigned id (not the default autoincremented long), the id assignment must not be in the constructor, but in a different line.

That means, having this domain:

class State implements Serializable {
    String id
    static mapping = {
    	id column: 'id', generator: 'assigned'
 }
@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 &amp;&amp; chmod +x minikube &amp;&amp; sudo mv minikube /usr/local/bin/
@fennb
fennb / gist:1283573
Created October 13, 2011 06:35
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@nikos
nikos / GradleTaskTimer.gradle
Created October 23, 2012 15:22
Measure time for the execution of each gradle task executed
class TaskTimerListener implements TaskExecutionListener {
private Clock clock
@Override
void beforeExecute(Task task) {
clock = new org.gradle.util.Clock()
}
@Override