Skip to content

Instantly share code, notes, and snippets.

View skyeagle's full-sized avatar

Anton Orel skyeagle

View GitHub Profile
@skyeagle
skyeagle / example1.json
Created September 10, 2021 20:46
Log examples
{
"id": "AQAAAXvRdDmtrO4k0wAAAABBWHZSZEQyT0FBRFFaQXBpTEtzemxBQUU",
"content": {
"timestamp": "2021-09-10T20:44:20.269Z",
"tags": [
"container_name:homebase1",
"source:undefined",
"task_version:31",
"cluster_name:g5-production-cluster",
"region:us-west-2",
39de1854-3b18-4389-bcd9-3177ce4bf7dc
2020-06-12 16:53:57 -0700
service g4-staging-staging-rails-svc has reached a steady state.
937bdf96-c6a4-4073-bc63-9d14027735e7
2020-06-12 16:53:36 -0700
service g4-staging-staging-rails-svc has stopped 1 running tasks: task 37db882f-d1ba-48ae-996d-420161f3ec9c.
ddbf9977-b8f2-4333-91db-e58a407aceaf
2020-06-12 16:53:14 -0700
service g4-staging-staging-rails-svc has begun draining connections on 1 tasks.
be036d6d-74f1-4bf3-903a-c39bb01e23f3
hey -c 2 -n 100 http://localhost:3000/accounts/sign_in
Summary:
Total: 52.7159 secs
Slowest: 6.7247 secs
Fastest: 0.5989 secs
Average: 1.0044 secs
Requests/sec: 1.8970
ENV['RAILS_ENV'] = 'production'
require File.expand_path('../../../config/environment', __FILE__)
require 'flamegraph'
require 'ruby-prof'
def helper_method(*args); end
include RablHelper
include PermissionHelper
@skyeagle
skyeagle / truncate.rb
Created March 29, 2016 18:32
Smart truncate method. It doesn't break words. Add it to rails initializers
module ActionView::Helpers::TextHelper
def truncate(text, *args)
return '' unless text
text.truncate(*args)
end
end
class String
def truncate(*args)
options = args.extract_options!