In you ~/.bash_profile
, add:
alias a="/Applications/Atom.app/Contents/MacOS/Atom $1"
# Implement an algorithm | |
# to determine if a string has all unique characters | |
# without using uniq. | |
# What if you can not use additional data structures? | |
# === | |
sample = "abcdę" | |
sample.split('').uniq.count == sample.split('').count | |
sample.split('').uniq.count == sample.length |
desc "It's says 'Hey'" | |
task :say_hey do | |
`say hey` | |
end | |
desc "It says 'Hey you'" | |
task :say_hey_you => [:say_hey] do | |
`say you` | |
end |
# Go through the numbers 0 through 100 (including both 0 and 100) | |
# If the number is divisible by 3, print "Fizz" | |
# If the number is divisible by 5, print "Buzz" | |
# If the number is divisible by both 3 and 5, print "FizzBuzz" | |
# Otherwise print the number | |
# Solution 1 | |
# | |
# (0..100).each do |i| | |
# if (i % 3 == 0) && (i % 5 == 0) |
guard :minitest do | |
watch(/test\/.+_test\.rb/) | |
watch(/lib\/(.+)\.rb/) do |data| | |
"test/#{data[1]}_test.rb" | |
end | |
end |
class Garden | |
attr_reader :layout, :row_0, :row_1 | |
def initialize(layout, two=nil) | |
@row_0, @row_1 = layout.split("\n") | |
@layout = layout.gsub("\n", "") | |
end | |
def alice |
class Garden | |
attr_reader :row_0, :row_1, :names | |
def initialize(layout, names=nil) | |
@row_0, @row_1 = layout.split("\n") | |
@names = format_names(names) || default_names | |
build_name_accessor_methods | |
end | |
def format_names(names) |
module Sinatra | |
module AdminRoutes | |
def self.registered(app) | |
app.get "/admin/pages" do | |
pages = Page.all | |
erb 'admin/pages' | |
end | |
end |
class Game | |
def get_input | |
gets.chomp | |
end | |
def play | |
unless get_input == "quit" | |
puts "Still Going" | |
end | |
class InputFetcher | |
def fetch | |
gets.chomp | |
end | |
end | |
class Game | |
attr_reader :fetcher | |
def initialize(fetcher_type = InputFetcher) |