- Installed solargraph gem
gem install solargraph
or add it to your Gemfile
- Installed vscode extentions
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
{ | |
"users": [ | |
{ | |
"id": 1, | |
"name": "Leanne Graham", | |
"username": "Bret", | |
"email": "Sincere@april.biz", | |
"address": { | |
"street": "Kulas Light", | |
"suite": "Apt. 556", |
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
Money = Struct.new("Money", :value) do | |
def add(other) | |
self.class.new(value + other.value) | |
end | |
end | |
hundred_yen = Money.new(100) | |
two_hundred_yen = Money.new(200) | |
result = hundred_yen.add(two_hundred_yen) | |
p result | |
# => #<struct Struct::Money value=300> |
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
FROM ruby:2.5 | |
RUN apt-get update -qq && apt-get install -y postgresql-client | |
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - | |
RUN apt-get install -y nodejs | |
RUN mkdir /<app-dir> | |
WORKDIR /<app-dir> | |
COPY Gemfile /<app-dir>/Gemfile | |
COPY Gemfile.lock /<app-dir>/Gemfile.lock | |
RUN bundle install | |
COPY . /<app-dir> |
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 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'aws-sdk' | |
gem 'activesupport' | |
gem 'pry-byebug' | |
end | |
require 'active_support' |
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
queue_name = # Put a queue name | |
queue = Sidekiq::Queue.new(queue_name); | |
jobs = queue.map { |j| j }; | |
target_classes = jobs.map { |j| j.klass }.uniq; | |
data = target_classes.map { |k| | |
{ class: k, jobs: jobs.select { |j| k == j.klass } } | |
}; | |
# data structure |
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
HEADER = "name,tags,time,total_count,mean_mean_duration,max_mean_duration,mean_upper_duration,max_upper_duration,total_duration" | |
INPUT_FILE_NAME = "input.txt" | |
def remove_header(data) | |
data.gsub("#{HEADER}\n", "") | |
end | |
def parse_data(data) | |
data.map do |dataset| |
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
#!/bin/bash | |
docker rm $(docker ps -a -q) | |
docker rmi $(docker images -q) |
NewerOlder