Skip to content

Instantly share code, notes, and snippets.

View kevintanhongann's full-sized avatar
🏠
Working from the cafe

Kevin H.A Tan kevintanhongann

🏠
Working from the cafe
View GitHub Profile
@kevintanhongann
kevintanhongann / TestSpringMicro.groovy
Last active December 18, 2015 12:24
This is a demo on Spring Boot micro service by using only one groovy script. To run this, use 'spring run TestSpringMicro.groovy'.
@Grapes(
@Grab(group='org.springframework', module='spring-web', version='4.2.4.RELEASE')
)
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@kevintanhongann
kevintanhongann / build.gradle
Created May 5, 2016 04:59
Gradle filter alpha beta version out sample gradle file
apply plugin: 'java'
apply plugin: 'project-report'
configurations.all {
resolutionStrategy {
componentSelection {
all {
if(selection.candidate.version.contains('Alpha')) || selection.candidate.version.contains('Beta')){
selection.reject("rejecting non-final")
}

Keybase proof

I hereby claim:

  • I am kevintanhongann on github.
  • I am kevinhatan (https://keybase.io/kevinhatan) on keybase.
  • I have a public key ASCd523HXDS-HYKcsXQjSbDuhlFYQNvH-HJzqvlUYkcPzAo

To claim this, I am signing this object:

def esVersion = '5.6.5'
ext['elasticsearch.version'] = esVersion
ext {
elasticsearchVersion = esVersion
}
compile 'org.grails.plugins:elasticsearch:2.4.0.RC1'
compile 'org.elasticsearch.plugin:mapper-attachments:2.3.3'
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
changeListener($event) : void {
this.readThis($event.target);
}
readThis(inputValue: any): void {
var file:File = inputValue.files[0];
var myReader:FileReader = new FileReader();
myReader.onloadend = (e) => {
this.image = myReader.result;
@kevintanhongann
kevintanhongann / FirebaseAuthService.groovy
Last active April 15, 2018 12:07
FirebaseAuthService
import grails.gorm.transactions.Transactional
import groovy.json.JsonSlurper
import groovyx.net.http.HttpBuilder
import io.reactivex.Emitter
import io.reactivex.Observable
import org.springframework.http.HttpStatus
import static groovyx.net.http.HttpBuilder.configure
import groovyx.net.http.*
@kevintanhongann
kevintanhongann / carousel
Last active June 18, 2018 07:10
test carousel
@kevintanhongann
kevintanhongann / Grails: createCriteria query, group by day, on a single date field Grails: createCriteria query, group by day, on a single date field (modify for grouping by month, year, hour, minute, seconds)
DOMAIN CLASS (Post):
String timeDay
Date date
static mapping = {
timeDay formula: "FORMATDATETIME(date, 'yyyy-MM-dd')" // h2 sql
//timeMonth formula: "DATE_FORMAT(time, '%Y-%m-%d')" // mysql sql
}
CONTROLLER:
def c = Post.createCriteria()
@kevintanhongann
kevintanhongann / build.gradle
Last active March 8, 2019 03:47
example-micronaut-gorm code snippets
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
id "com.github.johnrengelman.shadow" version "4.0.2"
}
apply plugin:"application"
apply plugin:"groovy"
version "0.1"
group "example.micronaut.gorm"