View gist:aacc0a6ca59b66990989
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
<input checked="checked" id="post_tag_ids_1" name="post[tag_ids][]" type="checkbox" value="1"> | |
<label for="post_tag_ids_1">adventurous</label> | |
<input id="post_tag_ids_2" name="post[tag_ids][]" type="checkbox" value="2"> | |
<label for="post_tag_ids_2">aggressive</label> |
View checkboxes
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
<%= form_for(@post) do |f| %> | |
<%= f.label :name %><br> | |
<%= f.text_field :name %><br> | |
<%= f.label :content %><br> | |
<%= f.text_area :content %><br> | |
Tags: | |
<%= f.collection_check_boxes :tag_ids, Tag.all, :id, :name %><br> | |
<%= f.submit %> | |
<% end %> |
View gist:3af125598e08b6ecdc8b
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
$lower_case = "abcdefghijklmnopqrstuvwxyz" | |
$upper_case = $lower_case.upcase | |
def caesar_encode(string, offset) | |
array = string.split("") | |
array.map! do |l| | |
if /[a-z]/ === l | |
idx = $lower_case.rindex(l) | |
idx = (idx + offset) % 26 | |
$lower_case[idx] |