Go to the console tab in your browser: right-click -> "inspect" -> "Console" tab
Paste the following script and press Enter
:
trap("SIGINT") { exit! } | |
total_width = `stty size`.scan(/\d+/)[1].to_i # terminal width | |
snowflakes = {} | |
puts "\033[2J"; # clearing output | |
loop do | |
snowflakes[rand(total_width)] = 0 |
# Workflow: | |
# | |
# 1- if the path points to a directory | |
# 1.1- if the directory isn't in the exclusion list then: count LOC | |
# 1.2- else: prune directory | |
# 2- else | |
# 1.1- if the file extension is whitelisted then: count LOC | |
# 1.2- else: next | |
require 'find' |
def usage | |
abort 'Wrong number of argument: ruby my_fir.rb FIR_SIZE' | |
end | |
def display_trunk(width) | |
trunk_width = trunk_height = ((width / 2) - 2).round | |
(1..trunk_height).each { puts ("|" * trunk_width).center(width) } | |
end | |
def display_level(width, line_length) |
en: | |
errors: | |
messages: | |
http_unauthorized: 'Authentication required' | |
http_not_found: 'Not found' | |
http_bad_request: 'Incorrect or incomplete input' | |
http_service_unavailable: 'Service unavailable' | |
http_forbidden: 'Forbidden' | |
http_unprocessable_entity: 'Unprocessable Entity' | |
resource_not_found: 'Resource not found' |
module TemporaryPatch | |
refine Hash do | |
def to_s | |
'' | |
end | |
end | |
end | |
my_ebook = { | |
ebook: 'Ruby Object Model', |
Regexp.new(".*").class # => Regexp | |
/.*/.class # => Regexp | |
%r{.*}.class # => Regexp |
if projects = /(?<domain>rubycademy)/.match('https://www.rubycademy.com') | |
p projects['domain'] # => "rubycademy" | |
end |
if /(?<domain>rubycademy)/ =~ 'https://www.rubycademy.com' | |
p domain # => "rubycademy" | |
end |