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
1.8.7 :012 > obj = [34773, 28566, 31509, 24366, 32891, 32230, 29208, 24501, 32027, 31359, 27217, 31430, 28049, 35981, 34471, 33724, 30934, 35097, 29596, 31871, 31603, 33786, 33399] | |
=> [34773, 28566, 31509, 24366, 32891, 32230, 29208, 24501, 32027, 31359, 27217, 31430, 28049, 35981, 34471, 33724, 30934, 35097, 29596, 31871, 31603, 33786, 33399] | |
1.8.7 :013 > total = 718588 | |
=> 718588 | |
1.8.7 :014 > list = obj.map{ | x | 1-(x/total).to_f } | |
=> [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] | |
1.8.7 :015 > | |
1.8.7 :016 > | |
1.8.7 :017 > list = obj.map{ | x | 1.0-(x/total) } | |
=> [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] |
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
1.8.7 :009 > k = 1 | |
=> 1 | |
1.8.7 :010 > [1,2,3].map {|x| 1-(x/k).to_f } | |
=> [0.0, -1.0, -2.0] | |
# Or | |
1.8.7 :011 > [1,2,3].map {|x| 1.0-(x/k) } | |
=> [0.0, -1.0, -2.0] | |
1.8.7 :012 > |
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
<!DOCTYPE> | |
<html> | |
<head> | |
<title>Dissecting Gmail's Email Attachments - Dropping Files</title> | |
<style> | |
.msg { | |
display: none | |
} | |
.dragging .msg { |
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
@javascript | |
Scenario: Creando Person nuevo # features/facebook.feature:4 | |
When I go to the facebook test page # features/step_definitions/web_steps.rb:23 | |
When I follow the non link "#curtain-centerpic" # features/step_definitions/web_steps.rb:217 | |
2011-10-24 13:15:26.622 webkit_server[3040:903] Error loading /Library/Internet Plug-Ins/DirectorShockwave.plugin/Contents/MacOS/DirectorShockwave: dlopen(/Library/Internet Plug-Ins/DirectorShockwave.plugin/Contents/MacOS/DirectorShockwave, 262): no suitable image found. Did find: | |
/Library/Internet Plug-Ins/DirectorShockwave.plugin/Contents/MacOS/DirectorShockwave: mach-o, but wrong architecture | |
2011-10-24 13:15:26.684 webkit_server[3040:903] Error loading /Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin: dlopen(/Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin, 262): no suitable image found. Did find: | |
/Library/Internet Plug-Ins/npgtpo3dautoplugi |
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
$ ./script/server | |
=> Booting Mongrel | |
=> Rails 2.3.5 application starting on http://0.0.0.0:3000 | |
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement': undefined local variable or method `version_requirements' for #<Rails::GemDependency:0xf6e64a78> (NameError) | |
from /usr/local/lib/site_ruby/1.8/rubygems.rb:254:in `activate' | |
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1204:in `gem' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:73:in `add_load_paths' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths' |
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
%h1= "\##{@post.secuencia} #{@post.titulo}" | |
%p= sanitize @post.descripcion | |
- for seccion in @post.seccione | |
.seccion | |
%h2= seccion.cabecera | |
.body= sanitize seccion.cuerpo | |
%hr |
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
= simple_form_for @post do |f| | |
... | |
= f.simple_fields_for :seccione do |seccion_f| | |
.seccion | |
%h2 Seccion | |
= seccion_f.input :cabecera | |
= seccion_f.input :cuerpo, :input_html => {:rows =>5} | |
= seccion_f.input :posicion | |
= f.button :submit |
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 Post < ActiveRecord::Base | |
... | |
has_many :seccione, :dependent => :destroy | |
accepts_nested_attributes_for :seccione, :reject_if => :all_blank | |
... | |
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
function create(){ | |
$this->form_validation->set_rules('title', 'Title', 'trim|required'); | |
$this->form_validation->set_rules('content', 'Content', 'trim|required'); | |
if($this->form_validation->run() == TRUE) { | |
$data = array( | |
'title' => $this->input->post('title'), | |
'contents' => $this->input->post('content') | |
); |
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
= simple_form_for(@post) do |f| | |
= render 'shared/error_messages', :target => @post | |
.inputs | |
= f.input :title | |
= f.input :sequence | |
= f.input :description, :input_html => {:rows =>5} | |
.actions | |
= f.button :submit |