Skip to content

Instantly share code, notes, and snippets.

@selvan
selvan / sample-brochure.html
Created March 3, 2011 10:25
Additional CSS for sample brochure
<style type="text/css">
.top {
margin-top: 10px;
}
.heading {
font-weight: bold;
font-size: 22px;
text-align: left;
color: #1788DC;
@selvan
selvan / sample-brochure.html
Created March 3, 2011 10:26
Cufon font replacement for sample brochure
<script src="js/jquery-1.4.min.js" type="text/javascript"></script>
<script src="js/cufon-yui.js" type="text/javascript"></script>
<script src="js/fonts/vanilla.cufonfonts.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
Cufon.replace($(".heading"));
});
</script>
@selvan
selvan / sample-brochure.html
Created March 3, 2011 10:27
Sample brochure complete
<html>
<head>
<link href="css/screen.css" rel="stylesheet" type="text/css"/>
<link href="css/ie.css" rel="stylesheet" type="text/css"/>
<link href="css/print.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
.top {
margin-top: 10px;
}
@selvan
selvan / wkhtmltopdf.txt
Created March 3, 2011 10:51
Convert webpage to pdf - webkit based rendering
wkhtmltopdf sample-brochure.html sample-brochure.pdf
@selvan
selvan / sample-brochure.html
Created March 3, 2011 11:00
sample brochure - Blue print CSS base layout
<html>
<head>
<link href="css/screen.css" rel="stylesheet" type="text/css"/>
<link href="css/ie.css" rel="stylesheet" type="text/css"/>
<link href="css/print.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
.top {
margin-top: 10px;
}
@selvan
selvan / dict
Created May 3, 2011 03:40
Offline English Dictionary Ubuntu
apt-get install dictd
apt-get install dict-gcide
apt-get install dict-moby-thesaurus
"Application -> Office -> Dictionary -> Edit –> Preference -> Add"
Description : <<Your description>>
Transport : Dictionary Server
Hostname : 127.0.0.1
Port : 2628
@selvan
selvan / application.rb
Created June 15, 2012 10:18
Custom Log Formatting - Rails 3
logger = Logger.new(File.join( Rails.root, "log", "my_#{ Rails.env}.log"), 'daily')
logger.level = Logger::INFO
logger.formatter = proc do |severity, datetime, progname, msg|
"#{datetime.strftime("%B %d %H:%M:%S")} #{Socket.gethostname}, [#{$$}]:, #{severity} MY_WEBAPP, #{msg}\n"
end
tag_log = ActiveSupport::TaggedLogging.new(logger)
config.logger = tag_log
# above code will produce log in format as shown below,
@selvan
selvan / apt-get
Created June 20, 2012 09:47
Local / LAN based apt-get
####### Machine A ###########
# create package index file
cd /var/cache/apt/archives/
dpkg-scanpackages . /dev/null | gzip -c -9 > Packages.gz
# start mongoose (code.google.com/p/mongoose) / any webserver with document root as "/var/cache/apt/archives/"
mongoose -r /var/cache/apt/archives/
####### Machine B ###########
# edit " /etc/apt/sources.list"
@selvan
selvan / timezone_rails
Created July 20, 2012 04:12
Timezone & Rails
How to configure timezone in Rails
====================================
Database table didn't care about timezone's. It just preserves datetime data.
Hence it is up to (Rails) applications to manage timezone's.
Rails application needs to manage timezone in two ways via configuration - config/application.rb
(See http://guides.rubyonrails.org/configuring.html for more details),
1. While storing data in DB, which TZ to use
> Allows us to use only :local or :utc TZ's
@selvan
selvan / rvm_ruby_rails
Created July 20, 2012 04:17
Rvm, Ruby and Rails
# change shell to bash
export SHELL=/bin/bash
# install mysql lib
sudo apt-get install libmysqlclient-dev
# install openssl & dev files
sudo apt-get install libssl-dev openssl
# install smb client libs