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
gem 'slim-rails' | |
gem 'sassc-rails' | |
gem 'any_login' | |
gem 'active_model_serializers', '~> 0.10.0' | |
gem 'responders' | |
gem_group :development do | |
gem 'annotate' | |
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
class Roulette | |
def method_missing(name, *args) | |
person = name.to_s.capitalize | |
3.times do | |
number = rand(10) + 1 | |
puts "#{number}..." | |
end | |
"#{person} got a #{number}" | |
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
module Printable | |
def print(message) | |
puts message | |
end | |
end | |
class Animal | |
include Printable | |
def speak | |
print("##") |
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
module StringColorize | |
refine String do | |
def red | |
color_code = 31 | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
def blue | |
color_code = 34 | |
"\e[#{color_code}m#{self}\e[0m" |
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
3.times do | |
class A | |
puts "Class opened" | |
end | |
end | |
# => Class opened | |
# => Class opened | |
# => Class opened |
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
# Some use case of OpenClass feature | |
def red(string) | |
color_code = 31 | |
"\e[#{color_code}m#{string}\e[0m" | |
end | |
def blue(string) | |
color_code = 34 | |
"\e[#{color_code}m#{string}\e[0m" | |
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
# What happens to existing behavior if older version object still exists | |
class MyClass | |
def print | |
puts 'This is still old behavior' | |
end | |
end | |
old_class = MyClass.new | |
# Modifying the original blue print or prototype |
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 Board | |
def initialize(text) | |
@text = text | |
end | |
def display | |
@text | |
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
#! /usr/bin/bash | |
apm install markdown-preview | |
apm install language-ruby | |
apm install autocomplete-ruby | |
# Lets you maintain long history of items you copied in past using `CTRL + SHIFT + v` | |
apm install clipboard-history | |
apm install goto-definition |
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
syntax "markdown" "\.md$" "\.markdown$" | |
## Quotations | |
color cyan "^>.*" | |
## Emphasis | |
color green "_[^_]*_" | |
color green "\*[^\*]*\*" | |
## Strong emphasis |