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
----------------------------------------------------------- Class: Array | |
Convert and array into a tuple. | |
------------------------------------------------------------------------ | |
helper to check for method existance in ruby 1.8- and | |
1.9-compatible way because `methods`, `instance_methods` and others | |
return strings in 1.8 and symbols in 1.9 | |
['foo', 'bar'].include_method?(: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
ssue model on the client side | |
class Issue < ActiveResource::Base | |
self.site = 'http://localhost:3000' | |
self.user = 'admin' | |
self.password = 'admin' | |
end | |
Retrieving issues | |
issues = Issue.find(:all) | |
puts issues.first@ |
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
the plugin: | |
http://github.com/tamoyal/simple_time_select#readme | |
in the view: (u don't have to use date_select, but i needed it) | |
<%= f.date_select :published_at %> | |
<%= f.time_select :published_at, | |
{ :default => Time.now.change(:hour => Time.now.hour), | |
:simple_time_select => true, | |
:minute_interval => 30, |
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 'rubygems' | |
require 'ffi-ncurses' | |
include FFI::NCurses | |
begin | |
stdscr = initscr | |
start_color | |
curs_set 0 | |
raw | |
cbreak | |
noecho |
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
ruby colfm.rb | |
/opt/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:61:in `ffi_lib': Could not open library 'libncursesw.so': libncursesw.so: cannot open shared object file: No such file or directory. Could not open library 'ncursesw': ncursesw: cannot open shared object file: No such file or directory (LoadError) | |
from /opt/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:43:in `map' | |
from /opt/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:43:in `ffi_lib' | |
from /opt/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/ffi-ncurses-0.3.2/lib/ffi-ncurses.rb:23 | |
from /opt/ruby-1.8.7-p72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' | |
from /opt/ruby-1.8.7-p72/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' | |
from colfm.rb:17 |
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 bind_hotkey | |
if !@mnemonic.nil? | |
ch = @mnemonic.downcase()[0] ## FIXME 1.9 | |
puts("test") | |
# meta key | |
mch = ?\M-a + (ch - ?a) | |
if @label_for.is_a? RubyCurses::Button and @label_for.respond_to? :fire | |
@form.bind_key(mch, @label_for) { |_form, _butt| _butt.fire } | |
else | |
$log.debug " bind_hotkey label for: #{@label_for}" |
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
{ | |
"section": [ | |
{ | |
"name": "help", | |
"sub-sections": [ | |
{ | |
"name": "about", | |
"place_holders": [ | |
{ | |
"name": "is it free?", |
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
<%= link_to_unless(true, "Search", root_path) do |name| %> | |
<% 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
class TranslationValue < ActiveRecord::Base | |
has_many :key_values | |
has_many :translation_keys, :through => :key_values | |
end | |
class TranslationKey < ActiveRecord::Base | |
has_many :key_values | |
has_many :translation_values, :through => :key_values | |
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
Processing TranslationValuesController#create (for 127.0.0.1 at 2010-05-03 19:07:03) [POST] | |
Parameters: {"commit"=>"Create", "translation_value"=>{"text"=>"value2", "translation_keys_attributes"=>{"0"=>{"name"=>"key2", "tag_list"=>""}}}, "authenticity_token"=>"J+dt/qHwHkbKygh0wBPnXPLtpkb3Pb8URxGucEbpLa0="} | |
Language Load (0.2ms) SELECT * FROM `languages` | |
Language Columns (0.6ms) SHOW FIELDS FROM `languages` | |
Language Load (0.0ms) SELECT * FROM `languages` WHERE (`languages`.`name` = 'English') LIMIT 1 | |
TranslationValue Columns (0.4ms) SHOW FIELDS FROM `translation_values` | |
TranslationValue Load (0.2ms) SELECT * FROM `translation_values` WHERE (`translation_values`.`text` = 'value2') LIMIT 1 | |
CACHE (0.0ms) SELECT * FROM `languages` WHERE (`languages`.`name` = 'English') LIMIT 1 | |
TranslationKey Columns (0.5ms) SHOW FIELDS FROM `translation_keys` | |
SQL (0.0ms) BEGIN |
OlderNewer