- Which version of Ubuntu should I use?
- What is bash?
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
res.sort! do |x,y| | |
archived = -> (z) {[:archived, 'archived'].include?(z.status)} | |
if archived.call(x) && archived.call(y) | |
0 | |
elsif !archived.call(x) && archived.call(y) | |
-1 | |
elsif archived.call(x) && !archived.call(y) | |
1 | |
elsif !archived.call(x) && !archived.call(y) | |
0 |
- X is an aspect of the Universe just like me.
- May X be well and happy.
- May X have no fears or sorrows.
- May X be healthy and free from illness.
- May X live calmly and peacefully.
- When see wrong done to X I will try to right it.
- When I see X suffering I will try to heal it.
- When I see X at war I will try to end it.
- X is just as deserving of compassion as myself or anyone.
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 spec_helper | |
--color | |
--format documentation |
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 scrub_uri | |
uri.strip! | |
unless uri.slice(0,4) == "http" do | |
uri = uri.prepend "http://" | |
end | |
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
<%= debug(params) if Rails.env.development? %> | |
<%= debug(session) if Rails.env.development? %> |
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 [topic, post] do |f| %> | |
<%= f.input :title %> | |
<%= f.input :body, rows: 8 %> | |
<% if post.image? %> | |
<div class="form-group"> | |
<p>Current image</p> | |
<%= image_tag( current_user.image.thumb.url ) %> | |
</div> | |
<% end %> | |
<%= f.input :image, as: :file %> |
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 | |
def new_any?(&block) | |
if block_given? | |
selected = self.select(&block) | |
else | |
selected = self | |
end | |
if selected.length == 0 | |
false |
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 | |
def new_map | |
new_array = [] | |
each do |item| | |
new_array << yield(item) | |
end | |
new_array | |
end | |
def new_select!(&block) |
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 new_map(array) | |
new_array = [] | |
array.each do |item| | |
new_array << yield(item) | |
end | |
new_array | |
end |