Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env groovy
import java.time.LocalDate
import java.time.Month
import static java.time.temporal.ChronoUnit.*
LocalDate electionDay = LocalDate.of(2020, Month.NOVEMBER, 3)
LocalDate now = LocalDate.now()

http://grails.github.io/grails-doc/3.0.x/guide/upgrading.html

Follow above instructions in order to get the content of your grails plugin from older grails into grails 3.

A few notes on plugin names and folder names, I put down a few things here: https://groups.google.com/forum/#!topic/grails-dev-discuss/cG_6mvAO3f8

In there I mentioed mvn install - which does not appear to work under normal circumstances, in order to get a plugin to work locally follow grails install instructions or do it as inline plugin ..

@dongwq
dongwq / variable-value-key-of-map.md
Created July 24, 2016 23:52 — forked from baybatu/variable-value-key-of-map.md
Using value of a variable as map key in Groovy

If you want to use a variable value as key of your map, then you should wrap your key with parenthesis. It makes key to be considered as expression instead of String literal.

String keyVar = "mykey"

def map0 = [keyVar : 12]
assert map0.keyVar == 12
assert !map0.mykey
@dongwq
dongwq / README.md
Last active August 29, 2015 14:23 — forked from balupton/README.md

Riot.js & MicroJS, a misplaced initiative

I was recently asked for my opinion about Riot.js and what I thought about the MicroJS movement, as part of my residency for the wonderful Hacker Retreat initiative. Here's my thoughts.

Looking at the source, Riot.js is only a jQuery based event emitter you can attach to instances called observable with a trivial router that aliases to pushState. Everything else, you create, including the the CRUD abilities.

As someone who've recently tried to go Micro.js. I've actually given up on this rebuild from the ground up style approach. There is no support, no documentation, and no community to help you accomplish big prime time applications. Once you hit a wall, or try do to something that isn't included in the trivial amount of code there is, you're on your own, with no help besides "figure it out! that's what micro.js is about!".

This problem at it's

@dongwq
dongwq / live query test.java
Created June 21, 2015 11:08
orientdb live query test
/**
* TODO: failed
*/
@Test
public void testLiveQuery() {
ODatabaseDocument db = new ODatabaseDocumentTx("memory:" + OrientDbAsDocTest.class.getSimpleName());
((ODatabaseDocumentTx) db).setSerializer(new ORecordSerializerBinary());
db.create();
-server
-Dfile.encoding=UTF-8
-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient
-Dawt.useSystemAAFontSettings=lcd
-Djava.net.preferIPv4Stack=true
-Dsun.java2d.opengl=true
-Dsun.java2d.d3d=false
-Xverify:none
-Xms600m
-Xmx600m

[✔] A completed task

[✔] Another completed task

[{nbsp}] An open task. Get to it!

@dongwq
dongwq / Dockerfile
Last active August 29, 2015 14:10 — forked from melix/Dockerfile
################################################
# Dockerfile to run Groovy containers
# Based on Java 8 image
################################################
FROM java:8u40-jdk
MAINTAINER Cédric Champeau
# Install GVM
:description: RevealJS Template to create a beautiful HTML Slideshow
:backend: revealjs
:author: Charles Moulliard
:twitter: cmoulliard
:blog: http://cmoulliard.github.io
// Themes : default, beige, moon, blood, night, serif, simple, sky, solarized
:revealjs_theme: default
:linkattrs:
:idprefix:
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```