Skip to content

Instantly share code, notes, and snippets.

@pjkelly
pjkelly / unicorn.rb
Last active April 19, 2017 09:27 — forked from pablitoc/unicorn.rb
require 'dotenv'
Dotenv.load
listen ENV.fetch('UNICORN_PORT', 5000), :backlog => ENV.fetch('UNICORN_BACKLOG', 200).to_i
worker_processes ENV.fetch('UNICORN_CONCURRENCY', 3).to_i
timeout ENV.fetch('UNICORN_TIMEOUT', 15).to_i
preload_app true
if ENV.include?('UNICORN_LOG')
stderr_path ENV.fetch('UNICORN_LOG')
// Load environment variables
require('dotenv');
// Cluster Initialization
var cluster = require('cluster');
// Code to run if we're in the master process
if (cluster.isMaster) {

Ron,

We've been doing some thinking about things that will help optimize the auction clock, especially at the end of auctions, and wanted to run some stuff by you. Because all client browsers and computers are different, we need a way to make sure that all clients are keeping the correct time based on the server. To achieve this, we have historically been sending down a message from the server to all clients with the current time on the server.

A few problems have occurred with this approach. One is that, since we moved you from a custom web sockets implementation to Pusher, you are now being charged based on the number of messages sent to the clients. This means that our messages to each connected client will add up very quickly, and we want to avoid that for you. The second problem is that the constant pusshing of information can be a drain on resources for the server, especially when it is unnecessary for the auction to be updating so frequently when the auction is weeks, days, even hours, away from exp

machine:
environment:
CODECLIMATE_REPO_TOKEN: mytoken
NODE_ENV: ci
node:
version: 0.10.26
dependencies:
pre:
- npm install -g codeclimate-test-reporter
test:
# mongoid 3.x
#
# As discussed in: http://blog.mongolab.com/2014/02/mongodb-driver-tips-tricks-mongoid-3
#
production:
sessions:
default:
# The standard MongoDB connection URI allows for easy replica set
# connection setup.
# Use environment variables or a config file to keep your
@pjkelly
pjkelly / example.md
Created December 14, 2012 19:34 — forked from anonymous/example.md
Unwrap text in Sublime Text.

Note: This assumes there are no spaces at the end of lines.

Example Text:

Praesent commodo cursus magna, vel scelerisque nisl
consectetur et. Nulla vitae elit libero, a pharetra
augue. Curabitur blandit tempus porttitor. Maecenas
faucibus mollis interdum. Donec ullamcorper nulla
non metus auctor fringilla. Cras mattis consectetur
window.AppName =
Models: {}
Colls: {}
Views: {}
Routers: {}
Data: {}
Pages:
Home:
init: ->
new AppName.Views.HomePage el: $("body")
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
puts message
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)