Skip to content

Instantly share code, notes, and snippets.

View stanBienaives's full-sized avatar

Stan BIENAIVES stanBienaives

View GitHub Profile
var query = window.location.search.substring(1);
var query = query.split("&");
for(i = 0; i < query.length; i++) {
var split = query[i].split('=');
var target = split[0];
var value = split[1];
if (target === "full_name") {
var split_name = value.split('%20')
@stanBienaives
stanBienaives / spot_encoding_errors.rb
Created September 27, 2013 14:48
Simple ruby script to spot encoding errors on a given in params.
#!/usr/bin/env ruby
file = ARGV.first
count = %x( wc -l #{file}).split.first.to_i
puts "Number of line in the file: #{count}"
min = 0
max = count
@stanBienaives
stanBienaives / pre-commit
Created September 4, 2013 16:31
Git hook to prevent unwanted Gemfile and Gemfile.lock to be commited
#!/bin/sh
#
# This script is triggered before every commit
# It raises an alert when Gemfile or Gemfile.lock has been modified.
# This is usefull when using localy a gem that must be included in Gemfile ( a degugger for instance).
# To enable this hook, rename this file to "pre-commit" and add it to .git/hooks/
# of C/P the following block in your existing .git/hooks/pre-commit
#IMPORTANT - for the hook to be active run: