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
# | |
# This file tells systemd how to run Sidekiq as a 24/7 long-running daemon. | |
# | |
# Customize this file based on your bundler location, app directory, etc. | |
# | |
# If you are going to run this as a user service (or you are going to use capistrano-sidekiq) | |
# Customize and copy this to ~/.config/systemd/user | |
# Then run: | |
# - systemctl --user enable sidekiq | |
# - systemctl --user {start,stop,restart} sidekiq |
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 | |
# Source: https://gist.github.com/ka8725/6053d55be74f15b53cabfc3ac4dc99df | |
# Installation: put this file into spec/support/matchers/ folder. | |
# Simple matcher that allows checking of an email was sent during an example run. | |
# | |
# @example Positive expectation | |
# expect { action }.to send_email | |
# |
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
git grep --name-only '< ApplicationJob' | xargs -I {} sed -i '' -e 's/< ApplicationJob/< BaseJobWithRetry/' {} |
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
def foo | |
puts 'hello from foo' | |
end | |
def bar(f) | |
f() | |
end | |
bar(foo) # => NoMethodError (undefined method `f' for main:Object) |
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 SMSGateway | |
# @param phone [String] | |
# @param message [String] | |
def self.send_message(phone, message) | |
puts "Hello #{phone}, #{message}" | |
end | |
end | |
User = Struct.new(:phone, :active) |
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 Base | |
end | |
class A < Base | |
def foo | |
puts 'foo' | |
end | |
end | |
class A < Base |
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
params = {a: 1, b: "2", n: {c: 3}} | |
struct = Magic.new(params) | |
struct.a # => 1 | |
struct.b # => "2" | |
struct.c # => undefined method "c" | |
struct[] # => undefined method "[]" | |
struct.a = 2 # => undefined method "a =" |
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
Running 30s test @ http://127.0.0.1:3000/users | |
1 threads and 16 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 321.24ms 37.67ms 794.62ms 93.10% | |
Req/Sec 49.87 6.95 60.00 67.80% | |
1491 requests in 30.08s, 13.32MB read | |
Requests/sec: 49.56 | |
Transfer/sec: 453.51KB | |
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 User | |
end | |
class UserChild < User | |
end | |
def cache | |
@cache ||= {} | |
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
@semaphore = Mutex.new | |
def cache | |
@cache ||= {} | |
end | |
def get_y | |
sleep 1 | |
Object.new | |
end |
NewerOlder