Skip to content

Instantly share code, notes, and snippets.

View moretea's full-sized avatar

Maarten Hoogendoorn moretea

View GitHub Profile
# vendor/plugins/refinery/config/locales/en.yml
en:
reorder_menu: Reorder menu
reorder_menu_done: "I'm done reordering the menu"
log_out: Log out
search: Search
search_submit: Go
refinery:
crudify:
created: "{{what}} was successfully created"
ActionController::Routing::Routes.draw do |map|
map_i18n map do |m|
map.connect blah
map.resource meh
end
end
# helper
def map_i18n map, &block
if site_has_multiple_languages
demolicious/
|-- LICENSE
|-- README
|-- content_part_layouts
| |-- config.yml
| |-- homepage.erb.html
| `-- nl.yml
|-- images
|-- stylesheets
`-- views
# What works
MyApp.config do
self.jar "miglayout-3.7"
self.gem "active_resource"
end
# What i'd like to see
MyApp.config do
jar "miglayout-3.7"
MigBuilder.build(:panel, :layout => [nil, "[right]"]) do |b|
b.add build(:label, "General"), :split, :span, :gap_top => 10
b.add build(:separator), :growx, :wrap, :gap_top => 10
b.add build(:label, "Company"), :gap => 10
@company = b.add build(:text_field, ""), :span, :growx
b.add build(:label, "contact"), :gap => 10
@contact = b.add build(:text_field, ""), :span, :growx, :wrap
class Facility < ActiveRecord::Base
# name :string
has_many :registers, :through => :facility_registers
end
class Register < ActiveRecord::Base
# name :string
# specific :boolean ("specific" if true or "shared" if false, determines if it can belong to one or many facilities)
# register_type :integer
CarRim.with_serie(CarSerie.first).count :group => "car_rim_variants.id", :include => :car_rim_variants
=> #<OrderedHash {1890=>1, 1700=>1, 1206=>1, 1624=>1, 1282=>1, 1358=>1, 1862=>1, 1748=>1, 1102=>1, 1387=>1, 1910=>1, 1758=>1, 1207=>1, 1283=>1, 1359=>1, 979=>1, 1606=>1, 1749=>1, 1407=>1, 1255=>1, 1797=>1, 1759=>1, 1664=>1, 1626=>1, 999=>1, 1284=>1, 1769=>1, 1256=>1, 1408=>1, 1446=>1, 1893=>1, 1627=>1, 1209=>1, 1247=>1, 981=>1, 1380=>1, 1922=>1, 1827=>1, 1257=>1, 1894=>1, 1875=>1, 1837=>1, 1628=>1, 1362=>1, 982=>1, 1438=>1, 1096=>1, 1381=>1, 1210=>1, 1828=>1, 1695=>1, 1258=>1, 1448=>1, 1277=>1, 1895=>1, 945=>1, 1382=>1, 1211=>1, 1249=>1, 1886=>1, 1696=>1, 955=>1, 1411=>1, 1278=>1, 1259=>1, 1212=>1, 1250=>1, 956=>1, 1279=>1, 937=>1, 1431=>1, 1260=>1, 1897=>1, 1631=>1, 928=>1, 966=>1, 1213=>1, 1365=>1, 1280=>1, 1109=>1, 1223=>1, 1432=>1, 1622=>1, 967=>1, 1100=>1, 929=>1, 1908=>1, 1889=>1, 1851=>1, 1604=>1, 1585=>1, 1281=>1, 1899=>1, 1823=>1, 1671=>1, 1101=>1, 930=>1, 1595=>1, 1215=>1}>
Then /^I should see that the name of the "([^"]*)" project is "([^"]*)"$/ do |number, name|
locate(:xpath, "//ul[@id='project_summary']/li[#{number.to_i}]//a[@class='project']").should have_content(name)
end
(rdb:34) direction == :up && index == self.position -1
SyntaxError Exception: compile error
/home/maarten/Projects/inFlow/app/models/person_project.rb:17: syntax error, unexpected tUMINUS_NUM, expecting $end
direction == :up && index == self.position -1
^
(rdb:34) direction == :up && index == (self.position) -1
true
# This is a fragment of my debugger session
10 def move direction
11 if [:up, :down].member? direction
12 transaction do
13 brothers = self.person.person_projects
14 brothers.each_with_index do |brother, index|
15 if direction == :up && index == self.position - 1 or
16 direction == :down && index == self.position + 1
17 begin