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
@imjayson
imjayson / Grails: createCriteria query, group by day, on a single date field
Last active October 23, 2019 14:57
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()
@McKinneyDigital
McKinneyDigital / share-twitter.js
Created June 6, 2012 20:21
Share to Twitter from a link using Javascript
// Opens a pop-up with twitter sharing dialog
var url = "http://google.com";
var text = "Replace this with your text";
window.open('http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');