This file contains hidden or 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
# [X] length/size | |
# [X] push | |
# [X] [] (slice) | |
# [X] pop | |
# [X] first | |
# [X] last | |
# [X] shift | |
# [X] unshift | |
# [X] each | |
# [X] select/reject/collect/inject |
This file contains hidden or 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
search_id | rank | property_id | price | |
---|---|---|---|---|
3 | 1 | 8011 | 3787 | |
4 | 1 | 326 | 752 | |
5 | 1 | 7973 | 780 | |
5 | 2 | 87 | 13580 | |
5 | 3 | 5265 | 19920 | |
6 | 1 | 5981 | 8349 | |
7 | 1 | 5814 | 6585 | |
9 | 1 | 3942 | 14780 | |
10 | 1 | 6925 | 11286 |
This file contains hidden or 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 CreateUsers < ActiveRecord::Migration | |
def change | |
create_table :users do |t| | |
t.string :name | |
t.timestamps | |
end | |
end | |
end |
This file contains hidden or 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 Square < Rectangle | |
def initialize(side) | |
@side = side | |
end | |
def height | |
@side | |
end |
This file contains hidden or 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
graph = {} | |
ObjectSpace.each_object(Class) do |klass| | |
sup = klass.superclass and graph[klass] = sup | |
end | |
puts "digraph{" | |
graph.map do |key, value| | |
puts %("#{key}"\n"#{key}"->"#{value}") | |
end | |
puts"}" |
This file contains hidden or 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
defmodule Future do | |
def new(fun) do | |
fn(x) -> | |
spawn_link fn -> | |
value = try do | |
{ :ok, fun.(x) } | |
rescue | |
e -> { :error, e } | |
end |
This file contains hidden or 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
# Node A: | |
# iex --sname "nodea" | |
Process.register self, :iex | |
# Blocking | |
receive do | |
{ :hello, pid } -> | |
IO.puts "Hello from #{inspect(pid)}" | |
end |
This file contains hidden or 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 BasicObject | |
def &&(other) | |
other | |
end | |
def ||(other) | |
self | |
end | |
end |
This file contains hidden or 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 'gems' | |
require 'nokogiri' | |
require 'octokit' | |
require 'open-uri' | |
doc = Nokogiri::HTML(open('https://rubygems.org/profiles/45069')) | |
repo_names = doc.search('.profile-list ol li a.profile-rubygem').map do |element| | |
gem = Gems.info(element.text.split(/\s+/)[1]) | |
gem['info'].match('kicks the ass') && gem['homepage_uri'].match(%r{github\.com/ahoward/(\w*)})[1] |
This file contains hidden or 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
#!/usr/bin/env ruby | |
EMOJIS = %w[#️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ © ® 🌀 🌁 🌊 🌋 🌌 🌍 🌎 🌏 🌐 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘 🌙 🌚 🌛 🌜 🌝 🌞 🌟 🌰 🌱 🌲 🌳 🌴 🌵 🌷 🌸 🌹 🌺 🌻 🌼 🌾 🌿 🍀 🍁 🍂 🍃 🍄 🎃 🎅 🎆 🎇 🎍 🎎 🎏 🎐 🎑 🎒 🎓 🎵 🎶 🏃 🐀 🐁 🐂 🐃 🐄 🐅 🐆 🐇 🐈 🐉 🐊 🐋 🐌 🐍 🐎 🐏 🐐 🐑 🐒 🐓 🐔 🐕 🐖 🐗 🐘 🐙 🐚 🐛 🐜 🐝 🐞 🐟 🐠 🐡 🐢 🐣 🐤 🐥 🐦 🐧 🐨 🐩 🐪 🐫 🐬 🐭 🐮 🐯 🐰 🐱 🐲 🐳 🐴 🐵 🐶 🐷 🐸 🐹 🐺 🐻 🐼 🐽 🐾 👀 👂 👃 👄 👅 👆 👇 👈 👉 👊 👋 👌 👍 👎 👏 👐 👣 👤 👥 👦 👧 👨 👩 👪 👫 👬 👭 👮 👯 👰 👱 👲 👳 👴 👵 👶 👷 👸 👹 👺 👻 👼 👽 👿 💀 💁 💂 💃 💅 💆 💇 💋 💌 💏 💐 💑 💓 💔 💕 💖 💗 💘 💙 💚 💛 💜 💝 💞 💢 💤 💥 💦 💧 💨 💩 💪 💫 💬 💭 🔥 😀 😁 😂 😃 😄 😅 😆 😇 😈 😉 😊 😋 😌 😍 😎 😏 😐 😑 😒 😓 😔 😕 😖 😗 😘 😙 😚 😛 😜 😝 😞 😟 😠 😡 😢 😣 😤 😥 😦 😧 😨 😩 😪 😫 😬 😭 😮 😯 😰 😱 😲 😳 😴 😵 😶 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀 🙅 🙆 🙇 🙈 🙉 🙊 🙋 🙌 🙍 🙎 🙏 🚶 🀄 🃏 🅰 🅱 🅾 🅿 🆎 🆑 🆒 🆓 🆔 🆕 🆖 🆗 🆘 🆙 🆚 🇨🇳 🇩🇪 🇪🇸 🇫🇷 🇬🇧 🇮🇹 🇯🇵 🇰🇷 🇷🇺 🇺🇸 🈁 🈂 🈚 🈯 🈲 🈳 🈴 🈵 🈶 🈷 🈸 🈹 🈺 🉐 🉑 🌂 🌃 🌄 🌅 🌆 🌇 🌈 🌉 🌽 🍅 🍆 🍇 🍈 🍉 🍊 🍋 🍌 🍍 🍎 🍏 🍐 🍑 🍒 🍓 🍔 🍕 🍖 🍗 🍘 🍙 🍚 🍛 🍜 🍝 🍞 🍟 🍠 🍡 🍢 🍣 🍤 🍥 🍦 🍧 🍨 🍩 🍪 🍫 🍬 🍭 🍮 🍯 🍰 🍱 🍲 🍳 🍴 🍵 🍶 🍷 🍸 🍹 🍺 🍻 🍼 🎀 🎁 🎂 🎄 🎈 🎉 🎊 🎋 🎌 🎠 🎡 🎢 🎣 🎤 🎥 🎦 🎧 🎨 🎩 🎪 🎫 🎬 🎭 🎮 🎯 🎰 🎱 🎲 🎳 🎴 🎷 🎸 🎹 🎺 🎻 🎼 🎽 🎾 🎿 🏀 🏁 🏂 🏄 🏆 🏇 🏈 🏉 🏊 🏠 🏡 🏢 🏣 🏤 🏥 🏦 🏧 🏨 🏩 🏪 🏫 🏬 🏭 🏯 🏰 👑 👒 👓 👔 👕 👖 👗 👘 👙 👚 👛 👜 👝 👞 👠 👡 👢 👾 💄 |