This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.git-completion.sh | |
alias gco='git co' | |
alias gci='git ci' | |
alias grb='git rb' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :yard do | |
desc "Generate yard documentation of controllers and models" | |
task :doc do | |
`yardoc app/models/**/*.rb app/controllers/**/*.rb config/routes.rb --output yardoc --protected` | |
puts "Generated doc to yardoc/index.html" | |
end | |
desc "Generate UML graph (requires dot, download Graphviz from http://www.graphviz.org/)" | |
task :graph do | |
#TODO use --db to specify specific yardoc db, but this doesn't seem to work with current version of yard-graph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require_dependency 'application_controller' | |
rescue LoadError => e | |
puts e | |
puts e.backtrace.join("\n") | |
require_dependency 'application' | |
end | |
[...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> HistoryItem.new(:historytype => "Foo").valid? | |
Foo | |
[] | |
=> true | |
>> HistoryItem.new(:historytype => "Foo").valid? | |
Blub | |
["Foo"] | |
=> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kschlichting@debian:/home/jmueller/.cruise/projects/ticketsystem/work$ sudo rake gems:install | |
(in /home/jmueller/.cruise/projects/ticketsystem/work) | |
kschlichting@debian:/home/jmueller/.cruise/projects/ticketsystem/work$ sudo gem list | |
*** LOCAL GEMS *** | |
actionmailer (2.3.4, 2.3.3, 2.3.2) | |
actionpack (2.3.4, 2.3.3, 2.3.2) | |
activerecord (2.3.4, 2.3.3, 2.3.2) | |
activeresource (2.3.4, 2.3.3, 2.3.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'factory_girl' | |
Dir["spec/factories/*"].each{|f| require f} | |
Factory.create :product | |
#=> new product with id=12 | |
Product.first.update_versioned(:charge_interval => 'daily') | |
#=> new product with id=13 | |
Product.all(:conditions => "id IN (select id from abstract_products group by name, edition having max(version))") | |
#=> Finds 12 instead of 13 | |
Product.all(:conditions => 'version = (SELECT MAX(version) FROM abstract_products AS inner_abstract_products WHERE inner_abstract_products.name = abstract_products.name)') | |
#=> Finds 13 correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Registering callbacks on property setters. | |
*/ | |
for(var prop in object){ | |
// Ignore functions | |
if(typeof object[prop] !== 'function'){ | |
(function(obj, attr) { | |
// If object does not already have a getter | |
if (!object.__lookupGetter__(prop)) { | |
// This variable will hold the value of the property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Heckle for Rails | |
# Calls heckle for each method of each model | |
# Idea: Instead of exluding ActiveRecord methods, grep model file for existing methods | |
# Load all models | |
Dir['app/models/**/*.rb'].each {|f| require_dependency f} | |
# Search all model classes | |
klasses_to_heckle = ActiveRecord::Base.send(:subclasses)-[ActiveRecord::SessionStore::Session] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dsl &b | |
Class.new{ | |
def r&b;instance_exec &b | |
end; def method_missing s,*_ | |
@m=[s,*@m];end}.new.r &b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xhtml="http://www.w3.org/1999/xhtml" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors" | |
xmlns:xi="http://www.w3.org/2001/XInclude" | |
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"> | |
<!-- Unroll the form (theme, components, inclusions) --> |
OlderNewer