Skip to content

Instantly share code, notes, and snippets.

View czj's full-sized avatar

Clément Joubert czj

View GitHub Profile
@czj
czj / gist:1251040
Created September 29, 2011 15:45
Custom .pryrc for OSX + Rails + polite
# This script is greatly inspired by Pry Everywhere by Luca Pette
# http://lucapette.com/pry/pry-everywhere/
# Use TextMate as default editor
Pry.config.editor = "mate -w"
# My pry is polite
Pry.hooks = {
:after_session => proc {
puts "\nGoodbye." if Pry.active_sessions == 1
@czj
czj / gist:1261139
Created October 4, 2011 08:20
CSS filtering for Google Reader (remove ads & useless links)
/*
http://www.google.fr/reader/*
*/
a[href*=feedburner],
a[href*=feedsportal],
img[src*=feedsportal] {
display:none !important;
}
@czj
czj / hosts
Created October 4, 2011 08:24
Hosts file for ads removal
127.0.0.1 da.feedportal.com
127.0.0.1 rss.feedportal.com
127.0.0.1 com.clubic.feedsportal.com
@czj
czj / gist:1263872
Created October 5, 2011 07:39
Script to encode with HandbrakeCLI (x264) 720p, high image quality, low file size
#!/usr/bin/env ruby
# encoding: utf-8
# x264 presets guide : https://forum.handbrake.fr/viewtopic.php?f=6&t=19426
X264 = "b-adapt=2:rc-lookahead=50:me=umh:bframes=5:ref=6:direct=auto:trellis=2:subq=10:psy-rd=1.0,0.10:analyse=all"
FORMAT = "--optimize --format mp4"
QUALITY = "--ab 64 --mixdown mono --quality 23 -e x264 -x '#{X264}'"
SIZE = "--width 1280 --height 720"
ARGV.each do |param|
@czj
czj / mame.markdown
Created October 21, 2011 20:25
Meilleurs jeux MAME

Meilleurs jeux MAME

Shoot'em up

  • Raiden **** (trop dur)
  • Raiden Fighters Jet **** (1990 trop joli, bien dur)
  • PROGEAR (2001, CAVE, trop dur)
  • ESP Galuda
  • ESP Galuda 2
  • Blazing Star (Neo Geo, pas trop harcode)
function init_checkout_selection_table(id) {
var table = $(id);
var clicked_td = null;
// Clicking on the input box changes the row to active
// Add this behaviour + simulate the first click
// Use triggerHandler to only execute the function (the input is already clicked)
table.find('input').on('click', function(event) {
table.find('.active').removeClass('active');
clicked_td = $(this).closest('td');
@czj
czj / ribbon.sass
Created January 25, 2012 19:21
Pure CSS 3 ribbons
.ribbon
overflow: hidden
// top left corner
position: absolute
right: -3.5em
top: 2.5em
// 45° clockwise rotation
+rotate(45deg)
+box-shadow(0 0 1em #888)
+background-image(linear-gradient(left, #050, #080, #090, #080, #050))
@czj
czj / test_helper_minitest_spork.rb
Created March 8, 2012 20:25
Sample TestHelper file to use with minitest+spork+shoulda+capybara
ENV["RAILS_ENV"] = "test"
require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
@czj
czj / Guardfile.rb
Created March 8, 2012 20:25
Sample Guardfile for spork+guard+rails+livereload
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'livereload' do
watch(%r{app/.+\.(erb|haml)})
watch(%r{app/helpers/.+\.rb})
watch(%r{(public/|app/assets).+\.(css|js|html)})
watch(%r{(app/assets/.+\.css)\.s[ac]ss}) { |m| m[1] }
watch(%r{(app/assets/.+\.js)\.coffee}) { |m| m[1] }
watch(%r{config/locales/.+\.yml})
@czj
czj / ajax_jquery_file_upload.js.coffee
Created April 20, 2012 10:37
AJAX form submit with file upload (HTML5) using only jQuery
$('#my_form').submit (event) ->
event.preventDefault()
$.ajax
url: $(@).attr("action")
data: new FormData(@)
type: "POST"
cache: false
contentType: false
processData: false