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
https://www.youtube.com/watch?v=kZcqyuPeDao | |
https://gist.github.com/nateberkopec/2b1f585046adad9a55e7058c941d3850 | |
https://www.speedshop.co/2015/07/15/the-complete-guide-to-rails-caching.html | |
https://www.railsspeed.com/ | |
https://www.speedshop.co/2015/07/29/scaling-ruby-apps-to-1000-rpm.html | |
https://www.speedshop.co/2015/10/07/frontend-performance-chrome-timeline.html | |
https://github.com/ruby-prof/ruby-prof | |
https://github.com/schneems/get_process_mem | |
https://github.com/ko1/allocation_tracer | |
https://github.com/evanphx/benchmark-ips |
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
# Add some methods to IRB::Context and IRB::Irb | |
# for easier timeout implementation. | |
class IRB::Irb | |
def status | |
@signal_status | |
end | |
end | |
class IRB::Context | |
attr_reader :irb |
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
188,139,85,078,41,251,234,35,275,136,014,270,179,46,89,172,052,207,192,55,205,42,133,26,37,71,083,153,97,142,197,134,159,109,162,79,184,101,4,169,196,185,195,59,103,204,170,22,247,24,144,036,21,80,065,149,217,3,222,104,60,232,64,224,44,161,231,094,230 |
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
Cms::Content.collection.aggregate([{"$group" => {"_id" => "$key", "count" => {"$sum" => 1}}}, {"$match" => {"count" => {"$gt" => 1}}}, {"$sort" => {"count" => -1}}]) |
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
http://live.datatables.net/IroN/399/edit |
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
.endmost is what you want when you call .last: the last N records in the result set without having to retrieve all records from the database, and it works with any ordering. You can impose filtering before, Message.where(…).in_order.endmost(10), and afterwards to filter your final results as well Message.in_order.endmost(10).where(…). | |
class Message | |
class << self | |
def in_order | |
order(created_at: :asc) | |
end | |
def recent(n) | |
in_order.endmost(n) |
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
$('#banDateOneReal').data("DateTimePicker").destroy(); | |
http://stackoverflow.com/questions/22957699/how-to-change-a-bootstrap-datetimepicker-language-during-running |
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
raw = ActiveRecord::Base.connection.execute(sql) | |
raw.each(:as => :hash) do |row| | |
puts row.inspect # row is hash | |
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
for request in `grep -e "undefined local variable or method .*html_safe" log/production.log -B 1 | grep FATAL | sed 's/.*FATAL.*\[\(.*\)\]/\1/g'`;do grep "$request" log/production.log | head -n 20 | grep current_user;done | sed 's/.*current_user\(.*\).*/\1/g' | sort | uniq -c | sort -n |
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
zgrep "END: current_user" production.log.2.gz | sed 's/\(.*\) \[.*INFO.*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\3\t\4\t\2\t\1/g' | sort -n | tail -n 20 | |
# with process:request | |
grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100 | |
# find with process:request, then loop back and find problems for each... | |
# Part 1 | |
grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100 > slow_requests_10_26_2015.txt | |
# Part 2 | |
for rqid in `cat slow_requests_10_26_2015.txt | sed 's/.*seconds\t\(.*\)\s.*2015.*/\1/g'`;do echo -e "API Calls for [$rqid]\n---------------------------\n"; grep $rqid production.log | grep "request to api.exigo.com" -A 1; echo -e "\n\n";done > exigo_slow_calls_report_10_26_2015.txt |