Skip to content

Instantly share code, notes, and snippets.

View pierre-b's full-sized avatar
💭
Working on https://captainmetrics.com

Pierre pierre-b

💭
Working on https://captainmetrics.com
View GitHub Profile
@pierre-b
pierre-b / config.fish
Created March 6, 2017 10:03
golang fish shell config
# config file
# vim ~/.config/fish/config.fish
# reload the config
# source ~/.config/fish/config.fish
# set the workspace path
set -x GOPATH /users/my-username/go
# add the go bin path to be able to execute our programs
@pierre-b
pierre-b / gcloud-fish.sh
Last active March 1, 2017 17:21
Set fish shell for gcloud sdk on OSX
set fish_user_paths path_to_your_google_cloud_sdk/bin
set -x MANPATH path_to_your_google_cloud_sdk/help/man /usr/local/share/man /usr/share/man /opt/x11/share/man
@pierre-b
pierre-b / updateUrlParameter.js
Last active June 13, 2016 14:35
Update or remove a parameter in a URL
// update a parameter in a URL
// or removes it if value is null
// browser should support forEach() function or use a polyfill
var updateUrlParameter = function(url, key, value){
var parser = document.createElement('a');
parser.href = url;
var newUrl = parser.protocol+'//'+parser.host+parser.pathname;
@pierre-b
pierre-b / preload-img.js
Created December 19, 2014 23:02
Javascript image preload
var preloadImage = function(src, callback){
var img = new Image();
img.src=src;
img.onload = function(){
callback();
}
};
// usage
preloadImage(path, function(){
@pierre-b
pierre-b / GTM affilae variables
Last active August 29, 2015 13:56
Example of Affilae's tracking variables
<script>
// MUST BE PLACED BEFORE THE GOOGLE TAG MANAGER SCRIPT
// push conversion's data into Google Tag Manager
dataLayer = [{
'affilae.ruleKey': 'xxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx',
'affilae.conversionId': '123',
'affilae.customerId': '123',
'affilae.amount': '100.5',
'affilae.payment': 'online' // online | bankwire | cheque | other
}];
function isTouchDevice() {
return "ontouchstart" in window || navigator.msMaxTouchPoints > 0;
}
@pierre-b
pierre-b / gist:3079001
Created July 9, 2012 21:17
Nginx config elasticsearch _search only
#API usage: feeds.mysite.fr/index/type?q=*
server {
listen 91.191.152.55:443;
server_name feeds.mysite.fr;
access_log /var/log/nginx/elasticsearch.access.log;
error_log /var/log/nginx/elasticsearch.error.log;
location / {