Skip to content

Instantly share code, notes, and snippets.

View jerome's full-sized avatar

Jérôme Lipowicz jerome

View GitHub Profile
@jerome
jerome / gist:1740394
Created February 4, 2012 21:49
extracts url and remove duplicate lines
perl -0ne 'print "$1\n" while (/a href=\"(.*?)\">.*?<\/a>/igs)' file.html | perl -ne '$H{$_}++ or print'
@jerome
jerome / README.md
Created December 17, 2011 11:03 — forked from eric/DISCLAIMER.md
Log directly to Papertrail or any remote syslog target from Heroku

Setting up syslog logging on Heroku

1. Update your Gemfile

gem 'remote_syslog_logger'

2. Add the initializer

Take the example initializers (see below) for Rails 2 and 3 and put the correct one in config/initializers/.

@jerome
jerome / gist:1460741
Created December 11, 2011 13:58
AWS IAM policy for a single full access S3 bucket
{
"Statement" : [
{
"Effect" : "Allow",
"Action" : ["s3:*"],
"Resource" : [
"arn:aws:s3:::bucketname",
"arn:aws:s3:::bucketname/*"
]
}, {
@jerome
jerome / gist:564210
Created September 3, 2010 17:22 — forked from nicolasblanco/gist:513149
capistrano bundler
From 77883e5358e488d10daa34e8490a6c57b5e0a536 Mon Sep 17 00:00:00 2001
From: Nicolas Blanco <slainer68@gmail.com>
Date: Sat, 7 Aug 2010 22:05:04 +0200
Subject: [PATCH 3/3] Adds basic Capistrano task for Bundler.
To use it, just require 'bundler/capistrano' in your Capistrano deploy file (deploy.rb).
Bundler will be activated after each new deployment.
---
lib/bundler/capistrano.rb | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
<!--/* OpenX Javascript Tag v2.8.5-rc7 */-->
<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',';
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
document.write ("?zoneid=96641");
document.write ('&amp;cb=' + m3_r);
if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
# Lets you define relations between ActiveRecord and Mongo objects
module MongoRelations
module InstanceMethods
# get an object representing the MongoMapper equivalent of this object
# for the purpose of access relations on the object
fattr(:mongo_obj) do
res = klass.mongo_class.new
my_id = id
res.class_eval do
$ export PATH=/opt/local/lib/postgresql84/bin:${PATH}
$ sudo env ARCHFLAGS="-arch x86_64" gem install ruby-pg
@jerome
jerome / databases.yml
Created March 21, 2010 23:15 — forked from eladmeidar/databases.yml
actionmailer settings
# = Outgoing email settings
#
# Each environment has it's own configuration options. If you are only
# running in production, only the production block needs to be configured.
#
# == Common configurations
#
# === Sendmail command
#
# production:
@jerome
jerome / validates_uniqueness_of.rb
Created February 22, 2010 14:01 — forked from RISCfuture/validates_uniqueness_of.rb
Reimplementation of validates_uniqueness_of that works optimally with MySQL.
module ActiveRecord::Validations::ClassMethods
def validates_uniqueness_of(*attr_names)
configuration = { :case_sensitive => true }
configuration.update(attr_names.extract_options!)
validates_each(attr_names,configuration) do |record, attr_name, value|
# The check for an existing value should be run from a class that
# isn't abstract. This means working down from the current class
# (self), to the first non-abstract class. Since classes don't know
# their subclasses, we have to build the hierarchy between self and
@jerome
jerome / gist:285288
Created January 24, 2010 16:21 — forked from ultraspeed/gist:282826
apache gzip
# Requires mod_deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html