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 Sample | |
class Scope | |
def output | |
'This is output' | |
end | |
end | |
def self.with_scope1(&block) | |
Scope.new.instance_eval(&block) | |
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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "activerecord" |
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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "activerecord" |
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
# ref: https://speakerdeck.com/shioyama/the-ruby-module-builder-pattern?slide=65 | |
class Predicable < Module | |
def initialize(*attribute_names) | |
@names = attribute_names | |
end | |
def included(klass) | |
@names.each do |name| | |
define_method "#{name}?" do |
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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "activerecord" |
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
tap "aquasecurity/trivy" | |
tap "argoproj/tap" | |
tap "brewsci/science" | |
tap "chezou/jumanpp" | |
tap "getsentry/tools" | |
tap "github/gh" | |
tap "heroku/brew" | |
tap "homebrew/bundle" | |
tap "homebrew/cask" | |
tap "homebrew/core" |
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
# simple example below: | |
# ruby github_historian.rb -o 'kayac/ecspresso' -b v0.13.0 -a v0.15.0 | |
require 'forwardable' | |
require 'optparse' | |
require 'open3' | |
class GitHubHistorian | |
class << self | |
def collect_commits(repository:, before_tag:, after_tag:, options: {}) |
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
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
# Official gem is too heavy to use. | |
## require 'asana' | |
# for debugging | |
## require 'pry' | |
require 'json' | |
require 'faraday' |
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
% fizzbuzz | |
dividable_by_15(X) :- dividable_by_5(X), dividable_by_3(X). | |
dividable_by_5(X) :- 0 is X mod 5. | |
dividable_by_3(X) :- 0 is X mod 3. | |
fizzbuzz(_) :- print('fizzbuzz'), nl. | |
fizz(_) :- print('fizz'), nl. | |
buzz(_) :- print('buzz'), nl. | |
original(X) :- print(X), nl. |
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 Restaurant(name) | |
@name = name | |
@function seat_area_by(guest) | |
seat_area = "" | |
if guest.is_smoker == "true" | |
( | |
seat_area.append("outside") | |
) | |
else | |
( |
NewerOlder