Skip to content

Instantly share code, notes, and snippets.

View mathpere's full-sized avatar

Mathieu Perez mathpere

View GitHub Profile
@robpatrick
robpatrick / CreatedAndLastUpdated.groovy
Created November 3, 2013 12:47
The Grails ORM technology - GORM, has the ability to auto-timestamp GORM objects with the date and time they were created and last updated, details can be found here: http://grails.org/doc/latest/guide/GORM.html#eventsAutoTimestamping Our developers didn't like to have to litter our GORM code with these attributes so I created an AST transformat…
package com.alkalinezoo.transform
import java.lang.annotation.Target
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import org.codehaus.groovy.transform.GroovyASTTransformationClass
/**
* Simple annotation that when used on a class adds two new fields of type {@code java.util.Date}
@levicook
levicook / gist:4132037
Created November 22, 2012 16:37
modeling friends and calculating mutual friends w/ mongodb
// ------------------------------------------------------------------
// Friend collection, where _id is a user.Id and Friends is a list, of user.Id.
// Note: friending and unfriending is a two step operation in this scheme:
> db.friends.find()
{ "_id" : 1, "friends" : [ 2, 3, 4 ] }
{ "_id" : 2, "friends" : [ 1, 3, 5 ] }
{ "_id" : 3, "friends" : [ 1, 2, 4, 5 ] }
{ "_id" : 4, "friends" : [ 1, 3, 5 ] }
{ "_id" : 5, "friends" : [ 2, 3, 4 ] }
@twonjosh
twonjosh / Create iOS Icons.jsx
Last active April 25, 2023 08:41 — forked from ma11hew28/Create Icons.jsx
Photoshop Script to Create iOS Icons from a source image
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com