Skip to content

Instantly share code, notes, and snippets.

View ilaborie's full-sized avatar
🐙
Hacking

igor ilaborie

🐙
Hacking
View GitHub Profile
@ilaborie
ilaborie / extract-size.ts
Created June 28, 2017 12:37
Extract size (Angular-cli)
import * as fs from 'fs';
import {basename, join} from 'path';
import {exec} from 'child_process';
import {hrtime} from 'process';
import * as formatFileSize from 'prettysize';
import * as Table from 'tty-table';
import {red} from 'chalk';
// Files utilities
const readDir = (dir: string): Promise<string[]> => new Promise((resolve, reject) =>
@ilaborie
ilaborie / key
Last active November 2, 2016 08:45
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+g",
"command": "editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
},
{
"key": "cmd+shift+l",
"command": "HookyQR.beautify",
@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/' })
}
};
@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"

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 / 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
@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 / 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 / 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 / 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