Skip to content

Instantly share code, notes, and snippets.

found_records = []
ActiveRecord::Base.connection.tables.each do |table|
klass = table.classify.constantize rescue next
klass.send(:columns).select{|col| col.type == :string}.collect(&:name).each do |column|
res = klass.all(:conditions => ["`#{table}`.#{column} like ?", "%bocrgk%"])
found_records << res if res.any?
end
end
p found_records
# get the image width and height for a remote image
require 'rubygems'
require 'open-uri'
require 'RMagick'
class RemoteImage
def initialize(path)
@image = Magick::ImageList.new.from_blob(open(path).read)
end
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:database => 'database',
:username => 'username',
:password => 'password',
:host => 'localhost'
:encoding => "utf8"
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<b:skin><![CDATA[/*
* Blogger Template Style
*
* Simple II
# user and group to run as
user www www;
# pid of nginx master process
pid /var/run/nginx.pid;
# number of nginx workers
worker_processes 6;
# Number of worker connections. 1024 is a good default
* div { zoom:1; }
.frame {
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='images/bg.png');
}
.frame .content {
overflow:hidden;
position:relative;
// toggle opacity for jQuery. toggles opacity between 1.0 and the specified value.
//
// usage:
//
// jQuery(selectory).toggleOpacity();
// jQuery(selectory).toggleOpacity({speed:"slow"});
//
//
// http://drawohara.com/post/205626543/jquery-toggleopacity
jQuery.fn.extend({
// Zoom
//
// Proportionnaly update font size
//
// Usage :
// $(document).ready(function () {
// $("#zoom-in").zoom("#to-zoom", 1.25);
// $("#zoom-out").zoom("#to-zoom", 0.8);
// });
//
#! /bin/sh
# ex :
# xslt.sh -IN foo.xml -XSL foo.xsl -OUT foo.out
# => java -classpath $XALAN_PATH org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out
XALAN_PATH="$HOME/lib/xalan-j_2_7_1/"
java -classpath $XALAN_PATH org.apache.xalan.xslt.Process $*
#!/usr/bin/env lua
-- This program aims to compress too big image when they are uploded
-- A directory and every subdirectories are watched via lua inotify binding :
-- http://github.com/hoelzro/linotify/
--
--
--
--
-- Requirements :