Skip to content

Instantly share code, notes, and snippets.

View Igosuki's full-sized avatar

Guillaume Balaine Igosuki

View GitHub Profile
@Igosuki
Igosuki / Some class for gist
Created December 21, 2011 12:50
Gist cccc
class Blabla {
}
@Igosuki
Igosuki / Validation of POJOS on grails
Created June 13, 2012 12:23
Validating POJOs in Grails
grailsApplication.config.grails.validateable.classes.each {
ValidationGrailsPlugin.addValidationMethods(grailsApplication, this.class.forName(it), null)
}
Example :
public class Bean {
@javax.validation.constraints.NotNull
private Long id;
@org.hibernate.validator.constraints.NotBlank
$("a[href='http://www.reddit.com/r/4chan/comments/17lc6h/v_tells_stories_when_they_acted_like_assholes/c86r4n2']").parent().parent().find("li a:contains('répondre')");
@Igosuki
Igosuki / gist:4745968
Last active December 12, 2015 08:39
Grails logging mocking
class LoggingEnabledTestCase extends GrailsUnitTestCase {
protected void setUp() {
super.setUp()
registerMetaClass(org.apache.commons.logging.LogFactory)
org.apache.commons.logging.LogFactory.metaClass.'static'.getLog = {instance ->
// This is taken from grails.tests.MockUtils and slightly changed to return a logger.
// Get the name of the class + the last component of the package
// (if it the class is in a package).
@Igosuki
Igosuki / bytecodeperf.groovy
Created February 9, 2013 17:00
Java & Groovy bytecode perf
@Test
public void performances_are_as_expected() {
long start, end;
def varsMap = {
start = System.currentTimeMillis()
def map =["${T11Tag.COUNTRY}": null, "${T11Tag.DATE_GZT}" : null, "${T11Tag.DOCNUM}" : null, "${T11Tag.F_OR_P}": null,
"${T11Tag.IPR_TYPE}": null, "${T11Tag.KIND}": null, "${T11Tag.LEC1}": null, "${T11Tag.LEC2}": null, "${T11Tag.STATUS}": null];
for (int i = 0; i < 100000; i++) {
@Igosuki
Igosuki / SshGroovyTest.groovy
Created February 9, 2013 17:01
Test an ssh connection using groovy and and jsch
import org.apache.ivy.plugins.repository.ssh.SshCache.CfUserInfo
import org.junit.Test
import com.jcraft.jsch.Channel
import com.jcraft.jsch.ChannelSftp
import com.jcraft.jsch.JSch
import com.jcraft.jsch.JSchException
import com.jcraft.jsch.Session
import com.jcraft.jsch.SftpException
import com.jcraft.jsch.UserInfo
$(function() {
$("#fond").attr("src","./images/regions_"+ancre+"00.png");
var slider = $("#slider").slider({
value:0,
min:0,
max:65,
slide: function( event, ui ) {
var nombre = ("0" + ui.value).slice(-2)
$("#fond").attr("src","./images/regions_"+ancre+nombre+".png");
}
var kittens = angular.module("ngKitten", []);
kittens.directive('kittens', function factory() {
var kittensDirective = {
restrict: 'AC',
scope: false,
compile: function compile(tElement, tAttrs, transclude) {
return {
pre: function preLink(scope, element, attrs) {
element.attr('ng-src', 'http://placekitten.com/'+element.attr('width')+'/'+element.attr('height');
@Igosuki
Igosuki / README.md
Last active August 29, 2015 14:01
Publishing to a dump branch for bower

Supposing:

  • The artefact is built with grunt
  • The destination directory of the build is 'dist' and contains all necessary distribution files + bower.json
  • The destination branch is 'build'
  • The the current main branch is 'develop'

Otherwise simply replace accordingly

@Igosuki
Igosuki / push-build.sh
Created May 27, 2014 08:44
Push to a release branch
wat=`expr $(git status --porcelain 2>/dev/null| egrep "^(M| M)" | wc -l)`
#Stash if there are uncommited files
if [ $wat -gt "0" ]; then
git stash
fi
#Release workflow
git branch -D build;
git checkout -b build;