Skip to content

Instantly share code, notes, and snippets.

View dcaliri's full-sized avatar

Diego Caliri dcaliri

  • Eventioz
  • Mendoza, Argentina
View GitHub Profile
@dcaliri
dcaliri / nginx.conf
Created October 15, 2014 01:58
/etc/nginx/nginx.conf
# This conf sample is fetched from http://unicorn.bogomips.org/examples/nginx.conf
worker_processes 4;
user root;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log warn;
events {
@dcaliri
dcaliri / gist.rb
Last active August 29, 2015 13:55
class Bill
def assign_rps_number_and_serial(save_it = nil)
rps = Bill.order(:rps_serial, :rps_number).where('rps_number IS NOT NULL').select(:rps_number, :rps_serial).last
number = rps.try(:rps_number) || 1
serial = rps.try(:rps_serial) || 'A'
self.rps_number, self.rps_serial = if number < 999999999999
[number + 1, serial]
else
[1, serial + 'A']