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 / Object_filter.js
Last active December 27, 2015 13:39
Object::filter /for @4ntoin3
var obj = {a:1,b:2,c:9,d:10,f:5};
Object.defineProperty(Object.prototype, "filter", {
value: function(f) {
return Object.keys(this).reduce(function(m, k) {
return f(this[k], k, this) ? (m[k] = this[k], m) : m;
}.bind(this), {});
},
enumerable: false,
writable: true
@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 / 1_supervisord.conf
Last active December 22, 2015 04:08
How to make Play Framework 2 work with Supervisord and Monit
[program:myplayapp]
; remove -Dconfig.file if necessary (play will use the default application.conf)
; change address and port if necessary or remove them to use the default values
command=java -Xms128M -Xmx512m -cp .:./lib/*:./target/staged/* -Dhttp.address=127.0.0.1 -Dhttp.port=9000 -Dconfig.file=./conf/application.prod.conf play.core.server.NettyServer .
: directory to the play framework app, where "myapp/" is the root
directory=/dir/to/myapp
process_name=myplayapp
autorestart=true
startsecs=10
stopwaitsecs=10
@FGRibreau
FGRibreau / netgrep.sh
Last active December 21, 2015 17:18
$ netgrep 8080 $ netgrep redis
# by https://twitter.com/consoleguru/status/371876352523517952
# tested on Debian, does not work on MacOS
alias netgrep='sudo netstat --inet -W -l -p --numeric-ports|grep $*'
@FGRibreau
FGRibreau / 1.sql
Created August 12, 2013 16:11 — forked from guillaumebort/1.sql
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,
<html>
<head>
<title>Redis Listener</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var conn;
var msg = $("#msg");
var log = $("#log");
function appendLog(msg) {
<html>
<head>
<title>Redis Listener</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var conn;
var msg = $("#msg");
var log = $("#log");
function appendLog(msg) {
@FGRibreau
FGRibreau / infoq.sh
Created July 4, 2013 12:34
Download videos from infoq
#!/usr/bin/env sh
# Usage:
# infoq.sh "www.infoq.com/presentations/twitter-soa"
curl -s -A "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10')" $1 | grep "<source src="
@FGRibreau
FGRibreau / pr.md
Created March 25, 2013 09:06 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@FGRibreau
FGRibreau / app.htm
Created February 13, 2013 22:37
#IUT #Nantes #Backbone #JavaScript
<body>
<div class="app container">
<div class="row-fluid">
<div class="span12">
<h2 class="app-heading">Facebook Friends App</h2>
<div class="app-toolbar btn-group">
<button class="btn" id="byName">Sort by name</button>
<button class="btn" id="byBirthday">Sort by birthday</button>
<input type="text" placeholder="Type something to look for..." />
<button class="btn btn-danger" id="removeSearch">