Skip to content

Instantly share code, notes, and snippets.

@dedico
dedico / pre-commit
Created May 30, 2012 12:07
Git pre-commit hook to precompile assets if anything changed in app/assets or vendor/assets
#!/bin/bash
# source rvm and .rvmrc if present
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm"
[ -s "$PWD/.rvmrc" ] && . "$PWD/.rvmrc"
should_precompile=0
# check if anything changed in app/assets
if git diff-index --name-only HEAD | egrep '^app/assets' >/dev/null ; then
@dedico
dedico / Program.cs
Created January 5, 2012 23:06
iTextSharp and unicode characters
using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace RussianPDFtest
{
class Program
{
<Set name="port"><SystemProperty name="jetty.port"/></Set>
<Set name="Host"><SystemProperty name="jetty.host" default="127.0.0.1"/></Set>
@dedico
dedico / jetty_addConnector.xml
Created June 17, 2011 19:40
jetty host configuration
<Call name="addConnector">
@dedico
dedico / jetty_path.txt
Created June 17, 2011 19:39
jetty config path
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/sunspot-1.2.1/solr/etc/jetty.xml
@dedico
dedico / deploy.rb
Created June 17, 2011 19:21
Update crontab task
namespace :deploy do
desc "Update the crontab file"
task :update_crontab, :roles => :db do
run "cd #{release_path} && whenever --update-crontab #{application}"
end
end
@dedico
dedico / schedule_v2.rb
Created June 17, 2011 19:12
whenever task v2
env :PATH, '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/ruby/lib/ruby/gems/1.9.1:/usr/local/ruby/bin'
env :SHELL, '/bin/bash'
env :MAILTO, '[email protected]'
every 1.day, :at => '01:15 am' do
command "backup perform -t test_backup -c /path/to/backup/config.rb"
end
@dedico
dedico / schedule_v1.rb
Created June 17, 2011 19:10
whenever task v1
every 1.day, :at => '01:15 am' do
command "backup perform -t test_backup -c /path/to/backup/config.rb"
end