Skip to content

Instantly share code, notes, and snippets.

View byroot's full-sized avatar

Jean Boussier byroot

View GitHub Profile
desc "convert a latin1 database with utf8 data into proper utf8"
task :convert_to_utf8 => :environment do
puts Time.now
dryrun = ENV['DOIT'] != '1'
conn = ActiveRecord::Base.connection
if dryrun
def conn.run_sql(sql)
puts(sql)
end
else
module Raven
class Report < Tilt::Template
def prepare
end
def evaluate(context, locals, &block)
if context.logical_path.include?('raven') || context.logical_path.include?('github-integration')
data
else
class Foo
@byroot
byroot / select2-testcase.html
Created June 15, 2012 17:34
SHow a failing case with select2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Select2 2.1</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Select2 JQuery Plugin">
<meta name="author" content="Igor Vaynberg">
import argparse
from pysrt import SubRipFile, SubRipItem, SubRipTime
parser = argparse.ArgumentParser(description='Merge 2 srt files.')
parser.add_argument('fin', type=str, nargs=2,
help='input file')
parser.add_argument(dest='fout', type=str, nargs=1,
help='the output file')
@byroot
byroot / git-squash.sh
Created March 19, 2012 09:58
Git squash
#!/bin/bash -e
# Go back to the last commit that we want to form the initial commit (detach HEAD)
branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
tag="tmp-$RANDOM"
git checkout HEAD
# reset the branch pointer to the initial commit,
# but leaving the index and working tree intact.
git reset --soft HEAD~1
From 84ac611267f44d8b0bd1fdec2cf92b24cebd4907 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@tigerlilyapps.com>
Date: Tue, 3 Jan 2012 10:55:46 +0100
Subject: [PATCH] Fix jquery.placeholder to avoid absolute positions
---
vendor/assets/javascripts/jquery.placeholder.js | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/vendor/assets/javascripts/jquery.placeholder.js b/vendor/assets/javascripts/jquery.placeholder.js
/*****************************************************************************
jQuery Placeholder 1.1.9
Copyright (c) 2010 Michael J. Ryan (http://tracker1.info/)
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
------------------------------------------------------------------------------
#!/usr/bin/python
class ItemMetaClass(type):
ITEM_CLASSES_INDEX = {}
def __new__(mcs, name, bases, dict):
cls = type.__new__(mcs, name, bases, dict)
if hasattr(cls, 'id'):
mcs.ITEM_CLASSES_INDEX[cls.id] = cls
return cls
@byroot
byroot / chrome_disable_web_security.sh
Created November 7, 2011 10:57
Shell helper for easy Facebook iframe debug in chrome (Mac OS only)
CHROME_BIN_DIR="/Applications/Google\ Chrome\ Canary.app/Contents/MacOS"
CHROME_BIN_BAK="$CHROME_BIN_DIR/chrome.bin"
CHROME_BIN="$CHROME_BIN_DIR/Google Chrome"
function is_chrome_tweaked() {
/usr/bin/file -b "$CHROME_BIN" | grep -q ASCII || /usr/bin/file -b "$CHROME_BIN" | grep -q shell
}
function tweak_chrome() {
if is_chrome_tweaked ; then