Skip to content

Instantly share code, notes, and snippets.

View sofadesign's full-sized avatar

Fabrice Luraine sofadesign

  • http://www.lunaweb.fr
View GitHub Profile
@sofadesign
sofadesign / Follow Hyperlink.tmCommand.rb
Created April 16, 2009 07:13
Texmate command: open markdown links
/* Cross browser transparency */
.transparent_class {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
<?php
// LIMONADE SESSION FEATURES EXAMPLES
require_once 'lib/limonade.php';
function configure()
{
// by default, session is enable. It automaticaly start a session with LIM_SESSION_NAME as name
option('session', false); // disable
option('session', true); // enable
<?php
// LIMONADE FLASH FEATURES EXAMPLES
require_once 'lib/limonade.php';
function configure()
{
option('env', ENV_DEVELOPMENT);
}
function before()
<?php
# LIMONADE URL REWRITING EXAMPLE
# In your .htaccess in your app folder
# <IfModule mod_rewrite.c>
# Options +FollowSymlinks
# Options +Indexes
# RewriteEngine on
echo `date "+%d %B %Y"` | awk '{ print substr(" ",1,(21-length($0))/2) $0; }'; cal | awk '{ getline; print " Mo Tu We Th Fr Sa Su"; getline; if (substr($0,1,2) == " 1") print " 1 "; do { prevline=$0; if (getline == 0) exit; print " "substr(prevline,4,17) " " substr($0,1,2) " "; } while (1) }' | awk -v cday=`date "+%d"` '{ fill=(int(cday)>9?"":" "); a=$0; sub(" "fill int(cday)" ","*"fill int(cday)"*",a); print a }'
require 'find'
require 'fileutils'
dir = '/your_directory'
Find.find(dir) do |path|
if FileTest.directory?(path) && File.basename(path) == '.svn'
p 'rm directory:' + path
FileUtils.remove_dir(path)
else
find your_project -type d -name .svn | xargs rm -rf
# Paperclip attachment, with sorting and special convert options
class PageAsset < ActiveRecord::Base
acts_as_list :scope => :page
has_attached_file :asset,
:styles => {
:small => "110x82#",
:thumb => "150x90#",
:large => "460x345>",
:original => "1600x1200>"
},