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
const Hooks = { ViewportResizeHooks} | |
const connectLiveSocket = () => { | |
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content') | |
const liveSocket = new LiveSocket('/my_app/live', Socket, { | |
params: { | |
_csrf_token: csrfToken, | |
viewport: { | |
width: window.innerWidth, | |
height: window.innerHeight |
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
# Hash keyed by y to speed to_s | |
def to_h | |
hash_with_default = Hash.new {|hash,key| hash[key] = []} | |
@points.inject(hash_with_default) { |hash, point| h[point.y] << point.x; 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
Resque.after_fork do |job| | |
# How many jobs should we process in each fork? | |
jobs_per_fork = [ ENV['JOBS_PER_FORK'].to_i, 1 ].max | |
# Set hook to nil to prevent running this hook over | |
# and over while processing more jobs in this fork. | |
Resque.after_fork = nil | |
# Make sure we process jobs in the right order. | |
job.worker.process(job) |