Skip to content

Instantly share code, notes, and snippets.

View geraudmathe's full-sized avatar

gerry geraudmathe

View GitHub Profile
@geraudmathe
geraudmathe / url_maker.rb
Last active January 3, 2016 22:29
create a url dynamically
url = "http://www.google.com"
params_hash = {:param_1=>"value_1", :param_2=>"value_2"}
parameterized = params_hash.map{ |k,v| "#{k}=#{v}" }.join("&")
[url, "?", parameterized].join #=> http://www.google.com?param_1=value_1&param_2=value_2
@geraudmathe
geraudmathe / sidebar-enhancements.sh
Created April 19, 2014 18:04
script for installing package SideBarEnhancements manually on ST2
#! /bin/sh
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
curl -LOk https://dl.dropboxusercontent.com/u/9303546/SublimeText/SideBarEnhancements.zip
tar -xvxf SideBarEnhancements.zip SideBarEnhancements
rm SideBarEnhancements.zip
@geraudmathe
geraudmathe / cucumber_api_step.rb
Last active August 29, 2015 14:00
cucumber api step
When /^I send (.*) (GET|POST|PUT|DELETE) request to (.* path)(?: with:)?$/ do |format, method, path, *body|
headers = case format
when /xml/i
{ 'CONTENT_TYPE' => 'text/xml' }
when /json/i
{ 'CONTENT_TYPE' => 'application/json' }
else
{}
end
@geraudmathe
geraudmathe / 0_reuse_code.js
Created May 15, 2014 13:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@geraudmathe
geraudmathe / classroom_rules.md
Created March 16, 2015 15:21
Classroom Rules

Classroom Rules

##Set by students

No phones, no chat with classmates during class/lessons Patience, understanding with each other Don't be distracted by social media/video games Keep the classroom tidy Collaborate with each other

@geraudmathe
geraudmathe / git-prune-history.sh
Last active January 16, 2018 16:54
This is useful to retrieve big files from git history and delete them from all history
#the command below will look at ALL objects in history and show you the biggest ones
git rev-list --all --objects |
sed -n $(git rev-list --objects --all | cut -f1 -d' ' | git cat-file --batch-check | grep blob | sort -n -k 3 | tail -n40 | while read hash type size; do echo -n "-e s/$hash/$size/p "; done) | sort -n -k1
#the command below will remove all reference for a given file
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch REPLACE_WITH_PATH' --prune-empty --tag-name-filter cat -- --all
# remove old referenes
rm -rf .git/refs/original/
# remove old referenes
git reflog expire --expire=now --all
# recreate referenes