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 "pry" | |
puts [1, 2, 3].inspect | |
result_1 = [1, 2, 3].reduce do |sum, n| | |
sum + n | |
end | |
puts result_1.inspect | |
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
require "csv" | |
require "base64" | |
require "typhoeus" # HTTP toolkit that is backed by CuRL | |
require "pry" # debugger | |
require "json" # JSON parser that comes with standard Ruby library | |
require "oj" # JSON parser but uses C extensions | |
keywords = [] | |
# { |
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
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include "article.h" | |
#include "formattable.h" | |
Article::Article(std::string t, std::vector<std::string> te) { | |
title = t; | |
text = te; | |
}; |
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 | |
abort("This script requires Ruby 2.4 or higher") if RUBY_VERSION.to_f < 2.4 | |
# Expects command to be run like | |
# `showroom-watch https://www.showroom-live.com/48_Orin_Mutou` | |
if ARGV[0] && /^https:\/\/www\.showroom-live\.com\/.*$/.match?(ARGV[0]) | |
url = ARGV[0] | |
else | |
abort("You must give a url as an argument (e.g. `./showroom-watch https://www.showroom-live.com/48_NAKAI_RIKA`)") |
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 "optparse" | |
require "active_support/all" | |
options = [] | |
input = nil | |
output = nil | |
has_two_timestamps= ->(arg) { | |
if arg.split(",").count == 2 | |
nil |
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 "active_support/core_ext/numeric/time" | |
require "capybara" | |
require "capybara/poltergeist" | |
require "dotenv" | |
require "logger" | |
require "json" | |
require "pry" | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, {js_errors: false}) |
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
def parse_album_id(type, url) | |
if type == "photo" | |
album_id = url.split('/')[-2] | |
elsif type == "album" | |
album_id = url.split('/')[-1].split('?')[0] | |
else | |
raise "The type, \"#{type}\" is not supported, #{}" | |
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 Animal | |
DATABASE = [ | |
{ id: 1, name: "Mockingbird" }, | |
{ id: 2, name: "Pheasant" }, | |
{ id: 3, name: "Duck" }, | |
{ id: 4, name: "Platypus" }, | |
{ id: 5, name: "Penguin" }, | |
{ id: 6, name: "Peacock" }, | |
{ id: 7, name: "Hummingbird" }, | |
{ id: 8, name: "Owl" } |
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
module ModuleA | |
class ClassInsideModule | |
end | |
end | |
class ClassA | |
class ClassInsideClass | |
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 'csv' | |
require 'pry' | |
// external csv file has headers: name_eng, name_jpn, team | |
// EXAMPLE: | |
// name_jpn | name_eng | team | |
// 宮脇咲良 | Miyawaki Sakura | KIV | |
module Janken |
NewerOlder