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 "bloodbath" | |
scheduled_for = 5.minutes.from_now | |
100.times do | |
id = User.ids.sample | |
Bloodbath::Event.schedule( | |
scheduled_for: scheduled_for, | |
headers: { 'Content-Type': 'application/json' }, | |
method: :get, |
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 "bloodbath" | |
scheduled_for = 5.minutes.from_now | |
500.times do | |
Bloodbath::Event.schedule( | |
scheduled_for: scheduled_for, | |
headers: { 'Content-Type': 'application/json' }, | |
method: :get, | |
body: { offset: rand(0..1000) }, | |
endpoint: 'https://api.my-staging-project.com/users' |
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 "tempfile" | |
# catch various system process output | |
module Engines::Core::Infrastructure::Utils | |
class CaptureProcess | |
class << self | |
def error(&block) | |
capture($stderr, &block) |
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
# report for each | |
# 0.010811 0.001804 0.012615 ( 0.013084) | |
# report for reduce | |
# 0.007351 0.001876 0.009227 ( 0.009232) | |
n=1000000 | |
Benchmark.bm do |x| | |
x.report do | |
puts "report for each" |
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
# report for each | |
# 0.007854 0.001874 0.009728 ( 0.010521) | |
# report for tally | |
# 0.782440 0.076243 0.858683 ( 0.858839) | |
n=100 | |
Benchmark.bm do |x| | |
x.report do | |
puts "report for each" |
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
# what it looks like after a while | |
<svg width="160px" height="39px" viewBox="0 0 160 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" font-family="Rancho-Regular, Rancho" font-size="50" font-weight="normal"> | |
<g id="email_blue" transform="translate(-374.000000, -120.000000)" fill="#FFFFFF"> | |
<text id="AskAlfred"> | |
<tspan x="374.897461" y="154">AskAlfred</tspan> | |
</text> | |
</g> | |
</g> | |
</svg> |
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
# MIGRATION | |
change_column :my_table, :status, :string | |
# LOGICS | |
module SafeEnumHelper | |
def self.ensure(resource:, column:, mapping:) | |
raw_status = resource.attributes_before_type_cast[column] | |
is_integer = /\A[-+]?\d+\z/ === raw_status | |
if is_integer |
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
import gql from 'graphql-tag' | |
import EventsService from '@/services/EventsService' | |
import _ from 'lodash' | |
const CurrentIdentity = gql` | |
query CurrentIdentity { | |
currentIdentity { | |
id | |
role | |
token |
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
import gql from 'graphql-tag' | |
import EventsService from '@/services/EventsService' | |
import _ from 'lodash' | |
const CurrentIdentity = gql` | |
query CurrentIdentity { | |
currentIdentity { | |
id | |
role | |
token |
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
import gql from 'graphql-tag' | |
import EventsService from '@/services/EventsService' | |
import _ from 'lodash' | |
const CurrentIdentity = gql` | |
query CurrentIdentity { | |
currentIdentity { | |
id | |
role | |
token |