Skip to content

Instantly share code, notes, and snippets.

View FGRibreau's full-sized 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 / 1_stripe-schema.md
Last active March 8, 2024 14:57
Stripe database schema (extracted from their sigma product) as of 2019-10-09
jqn -r markdown-table 'map(x => "## " + x.name + "\n\n" + markdownTable(x.columns.map(y => [y.name, y.type]))  ) | join("\n\n")' < /tmp/stripe.json

accounts

id varchar
business_name varchar
business_url varchar
### Keybase proof
I hereby claim:
* I am FGRibreau on github.
* I am fgribreau (https://keybase.io/fgribreau) on keybase.
* I have a public key whose fingerprint is 5C44 FB61 55CB 31BF 8CD7 9ED7 BD7F 1108 C2C8 5857
To claim this, I am signing this object:
@FGRibreau
FGRibreau / HeaderValueExt.rs
Last active September 29, 2023 16:15
Convert a HeaderValue into a rust String
/// Additional conversion methods for `HeaderValue`.
pub trait HeaderValueExt {
fn to_string(&self) -> String;
}
impl HeaderValueExt for HeaderValue {
fn to_string(&self) -> String {
self.to_str().unwrap_or_default().to_string()
}
}
@FGRibreau
FGRibreau / existsSync.js
Last active July 17, 2023 10:19
existsSync - Check if a file exist in NodeJS
/*
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 / table.filter.lua
Created September 26, 2012 19:59
Lua table.filter (JavaScript Array::filter equivalent)
-- table.filter({"a", "b", "c", "d"}, function(o, k, i) return o >= "c" end) --> {"c","d"}
--
-- @FGRibreau - Francois-Guillaume Ribreau
-- @Redsmin - A full-feature client for Redis http://redsmin.com
table.filter = function(t, filterIter)
local out = {}
for k, v in pairs(t) do
if filterIter(v, k, t) then out[k] = v end
end
@FGRibreau
FGRibreau / console_patch.js
Created September 6, 2012 11:56
Add timestamp information to the JavaScript console
/**
* 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.
*
@FGRibreau
FGRibreau / 0_readme.md
Created November 2, 2013 22:56
Mock NodeJS net.Socket with ReadWriteStream
var dummySocket = new ReadWriteNetStream();

// Debug
dummySocket.on('data', function(data){
console.log('write received', data);
});

dummySocket.write('hey !');
@FGRibreau
FGRibreau / .gitignore
Created July 18, 2012 12:29
Find if a NodeJS module is available to require or not
node_modules
@FGRibreau
FGRibreau / pid.js
Created February 16, 2012 18:41
Simple snippet for cross-platform .pid management in NodeJS. I use it for managing NodeJS apps with supervisord and monit
//
// Usage: require('./pid')("myapp");
//
var fs = require('fs');
module.exports = function(appname){
process.title = appname;
var PID_FILE = "/usr/local/var/run/"+process.title+".pid";
//Do this only one time !
makeChainable(console, 'assert clear count debug dir dirxml error exception group groupCollapsed groupEnd info log profile profileEnd time timeEnd warn'.split(' '));
//Usage:
console
.profile()
.time('testTime')
.group('GroupTest')
.debug('test', 1, 2, 3)
.warn('warniiing!')