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 NotificationsWorker | |
include Sidekiq::Worker | |
sidekiq_options queue: :notification, retry: false | |
def perform(actor_id, user_ids, action, target_type, target_id) | |
actor = User.find(actor_id) | |
target = target_type.constantize.find(target_id) | |
notifications = [] | |
ActiveRecord::Base.transaction 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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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 json_for(target, options = {}) | |
options[:root] = false | |
options[:scope] ||= current_user | |
options[:url_options] ||= url_options | |
serializer = options.delete(:serializer) || target.active_model_serializer | |
serializer.new(target, options).to_json | |
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
worker_processes 3 # amount of unicorn workers to spin up | |
timeout 30 # restarts workers that hang for 30 seconds | |
preload_app true | |
GC.respond_to?(:copy_on_write_friendly=) and | |
GC.copy_on_write_friendly = true | |
before_fork do |server,worker| | |
defined?(ActiveRecord::Base) and |
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
$ boom -n 100 -c 30 -h Authorization:"Bearer xxxxxxxxx" http://api.waggram.net/v1/me/feed | |
100 / 100 Boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! 100.00 % | |
Summary: | |
Total: 3.7877 secs. | |
Slowest: 2.0238 secs. | |
Fastest: 0.6192 secs. | |
Average: 1.0054 secs. | |
Requests/sec: 26.4014 |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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
# config/initializers/clear_logs.rb | |
if Rails.env.development? | |
MAX_LOG_SIZE = 2.megabytes | |
logs = File.join(Rails.root, 'log', '*.log') | |
if Dir[logs].any? {|log| File.size?(log).to_i > MAX_LOG_SIZE } | |
$stdout.puts "Runing rake log:clear" | |
`rake log:clear` | |
end | |
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
function tocLink(heading, title, href) { | |
var ele = '<li class="tooltipped tooltipped-w" aria-label="'+title+'">'+ | |
'<a href="'+href+'" aria-label="'+title+'"'+ | |
'class="js-selected-navigation-item sunken-menu-item">'+ | |
'<span class="full-word">'+title+'</span></a></li>' | |
return ele; | |
} | |
var header = "<li class='tooltipped tooltipped-w'><strong> Table of Contents</strong></li>" | |
var rows = []; |
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
gem install interactive_editor |
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
#show git branch | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local WHITE="\[\033[1;37m\]" | |
local GREEN="\[\033[0;10m\]" |
OlderNewer