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
# app/forms/registration.rb | |
class Registration | |
include ActiveModel::Model | |
attr_accessor( | |
:company_name, | |
:email, | |
:first_name, | |
:last_name, | |
:terms_of_service |
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
<iframe width="700px" height="425px" src="http://online.fliphtml5.com/cgpf/jhut/#p=1" frameborder="0" allowfullscreen allowtransparency></iframe> |
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 find_index(values, target) | |
values.each_with_index do |value, i| | |
return i if value == target | |
end | |
end | |
find_index([2, 4, 6, 8, 10, 12], 6) | |
# => 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 'rspec' | |
string_collection = [ | |
"Web IconHTML & CSS100%", | |
"Command LineLearn the Command Line100%", | |
"Ruby IconRuby50%", | |
"Rails IconLearn Ruby on Rails100%", | |
"Git IconLearn Git100%", | |
"SassLearn Sass20%", | |
"JQuery IconjQuery1%", |
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
{ | |
"public": [ | |
{ | |
"thumb": "/uploads/user/avatar/thumb_6fd0915dcee8eb1a04bb215f68ecfa5a.png", | |
"name": "Lucky Luciano", | |
"email": "lif****@xample.com" | |
} | |
], | |
"privates": [ | |
{ |
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
# tenho a seguinte situação: | |
def update | |
ids = params["_json"].map { |hash| hash["id"] } # --> return [10, 20, 30, 40, 50] | |
positions = params["_json"].map { |hash| hash["position"] } # --> return [0, 1, 2, 3, 4] | |
query = MyQueryQuery.new | |
query.visible = true | |
query.active = true | |
OlderNewer