Skip to content

Instantly share code, notes, and snippets.

View ilaborie's full-sized avatar
🐙
Hacking

igor ilaborie

🐙
Hacking
View GitHub Profile
@ilaborie
ilaborie / post-commit
Created July 23, 2013 15:08
Git post-commit hook for: auto-push to jenkins + auto backup
#!/bin/sh
# Backup
git ls-remote backup --quiet
if test $? = 0;
then
git push backup --force --all --quiet
echo "...Backuped"
else
echo "No Backup repository => Skip backup"
@ilaborie
ilaborie / build.sbt
Created August 25, 2013 20:56
A Basic SBT project with ScalaTest and Scalastyle
name := "Imaging"
version := "1.0"
scalaVersion := "2.10.2"
libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"
// Scalastyle
org.scalastyle.sbt.ScalastylePlugin.Settings
@ilaborie
ilaborie / plugin.sbt
Created August 25, 2013 21:14
SBT plugin with IDEA, Eclipse, Scalastyle
// Resolvers
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"
// Eclipse generation
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")
// IDEA generation
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")
// Scalastyle
@ilaborie
ilaborie / Gruntfile.js
Last active August 29, 2015 14:02
Static website with Grunt and Handlebars
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'compile-handlebars': {
all: {
preHTML: 'src/pre.html',
postHTML: 'src/post.html',
template: 'src/body.hbs',
@ilaborie
ilaborie / Memo
Last active August 29, 2015 14:04
Basic Scala Memoïzation
case class Memo[A, B](f: A => B) extends Function1[A, B] {
private val cache = scala.collection.mutable.Map.empty[A, B]
def apply(x: A) = cache.getOrElseUpdate(x, f(x))
}
val fibonacci: Memo[Int, Int] = Memo {
case 0 => 0
case 1 => 1
case n => fibonacci(n - 1) + fibonacci(n - 2)
}
@ilaborie
ilaborie / SuperNumber
Created August 1, 2014 10:06
Scala SuperNumber
implicit class SuperNumber[A](i: A)(implicit integral: Integral[A]) {
import integral._
import Numeric.Implicits._
def squared: A = i * i
def pow(m: Int) = math.pow(i.toDouble(), m)
def **(m: Int) = pow(m)
def sqrt = math.sqrt(i.toDouble())
def isEven = dividesBy(2)
def isOdd = !isEven
@ilaborie
ilaborie / build.sh
Created October 3, 2014 08:47
Build Eclipse Target
#!/bin/bash
DIST="dist"
rm -rf $DIST/*
mkdir $DIST
function download {
echo "download $2 --> $1"
if [ ! -f "$1" ]; then
curl --progress -L -o $1 $2

How to Micro-services with Springboot with Config Server, Eureka, Zuul, Ribbon

Config server

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>
@ilaborie
ilaborie / keybindings.json
Created July 12, 2016 06:26
VSCode config
[
{
"key": "ctrl+g",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+shift+l",
"command": "HookyQR.beautify",
"when": "editorFocus"
@ilaborie
ilaborie / bs-config.js
Created July 26, 2016 05:31
BS config with proxy
const proxy = require('http-proxy-middleware');
module.exports = {
port: 8030,
open: false,
server: {
middleware: proxy('/api', { target: 'http://localhost:8000/' })
}
};