Skip to content

Instantly share code, notes, and snippets.

View geraudmathe's full-sized avatar

gerry geraudmathe

  • General Assembly
  • London
View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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 / gist:7335297
Created November 6, 2013 12:28
javascript common events
<!DOCTYPE html>
<html>
<head>
<title>Jquery events</title>
<style>
#mouseHover{ width:500px; height: 500px; background-color: red}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function(){
def compute operation, a, b
result = case operation
when 'a'
"#{a + b}"
when 's'
"#{a - b}"
when 'm'
"#{a * b}"
when 'd'
"#{a / b}"
@geraudmathe
geraudmathe / ember_view_events.js
Last active December 21, 2015 04:28
how to bind the same function to differents events
App.MyView = Ember.View.extend({
tagName: "td",
my_function: function(){
alert("Do stuff here")
//in this context, you should be able to get content directly by the key , like this.get('myKey')
// and the controller is available via this.get('controller')
},
click: function(){
my_function()
# COFFEE
@func
# JS
this.func
# COFFEE
@func()
# JS
this.func()