Skip to content

Instantly share code, notes, and snippets.

View elebescond's full-sized avatar

LE BESCOND Erwan elebescond

View GitHub Profile
@HugoPoi
HugoPoi / auto-merge.sh
Last active December 16, 2015 04:49
Auto-merge script for git repo. You must use auth 'ssh' and a cron task. Then add a tag to your branch with the prefix pattern, the script will auto merge to the last tag version.
#!/bin/sh
#
# Auto-merge script for git repo
# You must use auth 'ssh' and a cron task :-)
# Conf:
REPO_PATH=/home/user/yourgitrepo
TAG_PATTERN=prod*
# Conf End
cd $REPO_PATH
git fetch --tags
@letorbi
letorbi / require.js
Last active November 20, 2018 22:27
The first and now obsolete version of my Node.js' require function for browsers. Check https://github.com/letorbi/smoothie for a latest version.
// NEW VERSION AVAILABLE: Check out my GitHub repository at
// https://github.com/letorbi/smoothie for a new and improved version.
// Require() 0.3.4 unstable
//
// Copyright 2012,2013 Torben Haase <http://pixelsvsbytes.com/>
//
// Require() is free software: you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option) any
@bunkat
bunkat / index.html
Created April 8, 2012 15:40
Timeline using d3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Chronological Diagram of Asia</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style type="text/css">
.chart {
shape-rendering: crispEdges;
}
@gliese1337
gliese1337 / WebVTTParser.js
Created August 16, 2011 20:16
Non-incremental parser for WebVTT files.
/*
http://www.whatwg.org/specs/web-apps/current-work/webvtt.html
*/
function parseWebVTT(input){
"use strict";
var line,l,p,cue_list=[],
cue,cue_text,id,fields,
time_pat = /\s*(\d*:?[0-5]\d:[0-5]\d\.\d\d\d)\s*-->\s*(\d*:?[0-5]\d:[0-5]\d\.\d\d\d)\s*(.*)/;
//If the first character is a BYTE ORDER MARK (BOM) character, advance position to the next character in input.
@JamieMason
JamieMason / average.js
Created July 28, 2011 09:29
Using underscore.js, return the average value from an array of Numbers.
function average (arr)
{
return _.reduce(arr, function(memo, num)
{
return memo + num;
}, 0) / arr.length;
}
@naaman
naaman / gist:1053217
Created June 29, 2011 05:33
Hot Swapping With Maven, Jetty and IntelliJ

Hot Swapping With Maven, Jetty and IntelliJ

Based on Configuring Jetty, Maven, and Eclipse together with Hot Swap

I've always been a bit jealous when it comes to the Play! framework and the great dev mode they have for hot swapping classes at runtime. Jetty has a configuration setting, scanIntervalSeconds, that mimics this when working with a more traditional WAR, but does so by looking for changes to a file and restarting the server.

Fortunately, Jetty also provides the ability to rapidly test code with hot swapping. No more server restarts. The trick to getting hot swapping to work is to attach a remote debugger to your Jetty process. The following instructions outline how to do this in IntelliJ (tested with IDEA 10.5 CE).

Modify your jetty-maven-plugin to ignore the scan interval

  1. Open your pom and locate the plugins section
@burin
burin / each_with_index.coffee
Created June 27, 2011 14:33
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
Handlebars.registerHelper 'each_with_index', (array, fn) ->
buffer = ''
for i in array
item = i
item.index = _i
buffer += fn(item)
buffer