Skip to content

Instantly share code, notes, and snippets.

View kubicek's full-sized avatar

Jiří Kubíček kubicek

View GitHub Profile
@kubicek
kubicek / migration.rb
Created December 10, 2008 01:20
Rails Relationship Generator
class <%= migration_name %> < ActiveRecord::Migration
def self.up
add_column :<%= table_name%>, :<%= column_name%>, :integer
end
def self.down
remove_column :<%= table_name%>, :<%= column_name%>
end
end
@kubicek
kubicek / gist:35579
Created December 14, 2008 00:13
Pushr via capistrano
namespace :pushr do
set :pushr_path, "#{deploy_to}/pushr"
desc "Install pushr"
task :install do
run "git clone git://github.com/karmi/pushr.git #{pushr_path}"
end
task :check do
run "cd #{pushr_path}; rake app:check"
class Article < ActiveRecord::Base
acts_as_state_machine :initial => :opened
state :opened
state :state2, :enter => Proc.new {|model| puts "entering state 2" }, :after => Proc.new {|model| model.close! }
state :state3, :enter => Proc.new {|model| puts "entering state 3" }, :after => Proc.new {|model| model.close! }
state :state4, :enter => Proc.new {|model| puts "entering state 4" }
state :closed
state :returned
get '/?' do
haml_with_erb_layout :index
end
def haml_with_erb_layout(template, options={})
require 'haml' unless defined? ::Haml
require 'erb' unless defined? ::ERB
# options[:options] ||= self.class.haml if self.class.respond_to? :haml
data = lookup_template(:haml, template, options)
output = __send__("render_haml", template, data, options)
def form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
end
def adjust_font_size_for_person(param); 0; end
def current_person; Person.find(session[:person_id]); end
def form_for(record_or_name_or_array, *args, &proc); end
def domain_path(id); end
def check_domains_path; end
def edit_person_path; end
def subjects_path; end
def link_to(*params); end
#!/bin/sh
while [ 1 ]
do
sleep 5
/root/jdserv-syslog -q
done
[
{
:date=>2008-03-03,
:repositories=>[
{:name=>"prvni",
:commits=>...}
{:name=>"druhy",
:commits=>...}
]
},
/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=ljet4 -sOutputFile=- /home/kubicek/margin.ps - | /usr/local/libexec/tray_select.rb -L
import sys, os, optparse, re
def die(msg):
print >>sys.stderr, '%s: %s' % (sys.argv[0], msg)
sys.exit(1)
def getParser():
parser = optparse.OptionParser(
usage='%prog [OPTIONS] DIR',
description='Allow restricted git operations under DIR',
users:
kubicek:
repositories:
- "xnet/superstudent.git"
- "xnet/aukce.git"