Skip to content

Instantly share code, notes, and snippets.

View Igosuki's full-sized avatar

Guillaume Balaine Igosuki

View GitHub Profile
$(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");
}
@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
@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 / 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).
$("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 / 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
@Igosuki
Igosuki / Some class for gist
Created December 21, 2011 12:50
Gist cccc
class Blabla {
}