Skip to content

Instantly share code, notes, and snippets.

@fouad-j
fouad-j / FooBarQix
Last active December 29, 2015 18:41
import java.util.Map;
import java.util.TreeMap;
public class FooBarQix {
// TreeMap sort key 3 > 5 > 7 for priority
private static final TreeMap<Integer, String> FOOBARQIX = new TreeMap<Integer, String>() {{
put(7, "Qix");
put(3, "Foo");
put(5, "Bar");
@fouad-j
fouad-j / sh
Created October 27, 2016 23:07
Allow to filter data with awk
awk 'BEGIN {FS=";"}
((length($2)>5 || length($3)==7) && length($4)==0) {print "OK " $0; next}
{print "KO " $0}
' file
# input data
# col11OK;col12;col13
# col21;col22OK;col23
@fouad-j
fouad-j / .conkyrc
Created November 6, 2016 18:03
my conky config
# temps pour fermer conky en secondes. 0 = toujours actif
total_run_times 0
# affiche le texte sur la sortie standard
out_to_console no
# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
@fouad-j
fouad-j / ecran2.sh
Created November 25, 2016 20:24
Add new resolution for an additional screen
#! /bin/sh
########################################################
# Auteur : Fouad JADOUANI <fouad.j@live.fr>
# Description : Ajoute une nouvelle resolution pour un
# ecran additionel s'elle n'existe pas
################
# French documentation : http://doc.ubuntu-fr.org/xrandr
# Version 1.0
###############
# Historique :
@fouad-j
fouad-j / example_angular_toggle_service_es6.js
Last active May 3, 2017 21:08
example_angular_toggle_service_es6
angular.module('app').service('toggleService', function() {
const TOGGLE_LIST = ['TOGGLE_NAME_1', 'TOGGLE_NAME_2', 'TOGGLE_NAME_3'];
this.isEnable = toggleName => TOGGLE_LIST.includes(toggleName);
});
@fouad-j
fouad-j / example_angular_toggle_directive_es6.js
Created May 3, 2017 21:08
example_angular_toggle_directive_es6
angular.module('app').directive('featureToggle', function(toggleService) {
return {
restrict: 'A',
template: '<span ng-transclude></span>',
transclude: true,
link: function(scope, element, attrs) {
if(toggleService.isEnable(attrs.featureToggle)) element.remove()
}
};
});
@fouad-j
fouad-j / example_angular_toggle_html_es6.html
Created May 3, 2017 21:11
example_angular_toggle_html_es6
<div feature-toggle="TOGGLE_NAME_1">
<h1>FeatureToggle</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html',
userCss: 'e2e/reporter.css'
});
exports.config = {
framework: 'jasmine',
{
"name": "testweb",
"version": "0.0.1",
"description": "",
"author": "Fouad JADOUANI",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/fouad-j/init-project-angular.git"
},
@fouad-j
fouad-j / e2eLauncher.sh
Created May 24, 2017 23:20
prototype for e2e launcher to use it in jenkins for example
#!/usr/bin/env bash
set -u
source utils.sh
declare -A servers=([INTEGRATION]='pi@pi' [HOMOLOGATION]='fouad@integration' [UAT]='ubuntu@lisa-prod');
rapport_directory="./report/$(date +%d_%m_%Y__%H_%M)";
environment=${servers['HOMOLOGATION']};