Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
writing "#NoBullshit Tech-Lead" book https://getnobullshit.com

Francois-Guillaume Ribreau FGRibreau

✍️
writing "#NoBullshit Tech-Lead" book https://getnobullshit.com
View GitHub Profile
@FGRibreau
FGRibreau / keycloak-route-patterns-to-keep-open.txt
Created Feb 8, 2020
Minimal Keycloak route patterns to keep open (whitelist)
View keycloak-route-patterns-to-keep-open.txt
/auth/realms/<realm>/protocol/openid-connect/token
/auth/realms/<realm>/protocol/openid-connect/logout
/auth/realms/<realm>/protocol/openid-connect/auth
/auth/realms/<realm>/login-actions/first-broker-login
/auth/realms/<realm>/broker/after-first-broker-login
@FGRibreau
FGRibreau / existsSync.js
Last active Feb 1, 2020
existsSync - Check if a file exist in NodeJS
View existsSync.js
/*
fileExistSync - Check if a file exist in NodeJS
Twitter: @FGRibreau / fgribreau.com
Usage:
var fileExistSync = require('./fileExistSync');
var exist = fileExistSync('/var/folders/zm/jmjb49l172g6g/T/65b199');
Support for Nodev0.6
@FGRibreau
FGRibreau / strpad.lua
Created Sep 26, 2012
Strpad function in LUA
View strpad.lua
-- strpad(input, pad_length, [pad_string], [pad_type])
-- (php-style) implemented in LUA (inspired from https://gist.github.com/2625581)
-- @FGRibreau - Francois-Guillaume Ribreau
-- @Redsmin - A full-feature client for Redis http://redsmin.com
local function strpad(input, pad_length, pad_string, pad_type)
local output = input
if not pad_string then pad_string = ' ' end
if not pad_type then pad_type = 'STR_PAD_RIGHT' end
@FGRibreau
FGRibreau / console_patch.js
Created Sep 6, 2012
Add timestamp information to the JavaScript console
View console_patch.js
/**
* Patch the console methods in order to provide timestamp information
*
* Usage:
* > console.log('ok')
* 2012-09-06T11:52:56.769Z ok true
*
* Note:
* The patch will only be applied with the first call.
*
View AttributeObserver.Proto.js
$('#el').AttributeObserver(attr, callback, [delay]);
@FGRibreau
FGRibreau / convert.zsh
Created Jun 2, 2014
Convert MTS to MOV
View convert.zsh
for file in ./*.MTS
do
ffmpeg -i $file -vcodec mjpeg -b 100M -acodec pcm_s16be $file.mov
done
View PostgresToSNSWorker.js
// Basic PostgresToSNSWorker worker
const pg = require ('pg');
const pgConString = process.env.POSTGRESQL_CONNECTIONSTRING;
pg.connect(pgConString, function(err, client) {
if(err) {
console.log(err);
}
client.on('notification', function(msg) {
@FGRibreau
FGRibreau / merge.js
Created Aug 15, 2012 — forked from joseanpg/extend_and_merge.js
Merge as it should be ( == $.extend(true, {}, ...))
View merge.js
function myextend(/* args */){
var o = {}
, args = Array.prototype.slice.call(arguments)
, obj = args.shift()
, src = args.shift();
for (var p in src){
if (src.hasOwnProperty(p)){
if (hasOwn.call(obj,p) && typeof obj[p] === 'object' && obj[p] !== null) {
o[p] = myextend(obj[p],src[p]);
@FGRibreau
FGRibreau / array.until.js
Created Aug 20, 2012
Array::until - Return the array elements until a selector is matched #javascript
View array.until.js
Object.defineProperty(Array.prototype, 'until',{
/**
* Return the array elements until a selector is matched
* @param {Number|String|Function} selector
* @return {Array} A new array that goes from the first element to `selector`
*
* Usage:
* deepEqual([1,2,3,4,5].until(4), [1, 2, 3, 4])
* deepEqual(['a','b','c','d','e'].until('c'), ['a', 'b', 'c'])
* deepEqual([{t:'a'},{t:'b'},{t:'c'},{t:'d'}].until(function(o){return o.t == 'c';}), [{t:'a'},{t:'b'},{t:'c'}])
@FGRibreau
FGRibreau / uglifyjs-benchmark-results.md
Created Dec 15, 2012
Real-world benchmark results of UglifyJS v1 vs UglifyJS v2
View uglifyjs-benchmark-results.md

Compressing 4 bundles with Pound (npm view pound) with JavaScript production code from https://redsmin.com


UglifyJS v1

  • times: 37720ms 36971ms
  • output size: 533Ko, 479Ko, 120Ko, 538Ko