Skip to content

Instantly share code, notes, and snippets.

if you want to list all currently running jobs from console, try this
```ruby
workers = Sidekiq::Workers.new
workers.each do |_process_id, _thread_id, work|
p work
end
```
a work is a hash.
#
deb http://nginx.org/packages/ubuntu/ precise nginx
deb http://apt.newrelic.com/debian/ newrelic non-free
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ precise main restricted
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ precise main restricted
@rauxalach
rauxalach / gist:ce6032f8e56f98629dac
Created August 29, 2014 04:36
query on megt-test-4 sale activity
This file has been truncated, but you can view the full file.
Started GET "/sale_activity" for 127.0.0.1 at 2014-08-29 11:33:36 +0700
Processing by ActivitiesController#sale_activity as HTML
User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4 LIMIT 1
Setting Load (0.6ms) SELECT "settings".* FROM "settings" WHERE "settings"."key" = 'assessment_status_for_megt' LIMIT 1
Setting Load (0.8ms) SELECT "settings".* FROM "settings" WHERE "settings"."key" = 'bdl_referrals' LIMIT 1
SignupStatus Load (0.6ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'processing' LIMIT 1
SignupStatus Load (0.3ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'pending' LIMIT 1
CACHE (0.0ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'pending' LIMIT 1
SignupSubStatus Load (1.4ms) SELECT "signup_sub_statuses".* FROM "signup_sub_statuses" WHERE "signup_sub_statuses"."name" = 'In Progress' AND "signup_sub_statuses"."signup_status_id" = 1 LIMIT 1
C
@rauxalach
rauxalach / gist:a5d3e8a01a3d3c8be001
Created August 29, 2014 04:26
query sale activity
User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 5 LIMIT 1
Setting Load (0.8ms) SELECT "settings".* FROM "settings" WHERE "settings"."key" = 'assessment_status_for_megt' LIMIT 1
Setting Load (0.6ms) SELECT "settings".* FROM "settings" WHERE "settings"."key" = 'bdl_referrals' LIMIT 1
SignupStatus Load (0.7ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'processing' LIMIT 1
SignupStatus Load (0.6ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'pending' LIMIT 1
CACHE (0.0ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'pending' LIMIT 1
SignupSubStatus Load (0.7ms) SELECT "signup_sub_statuses".* FROM "signup_sub_statuses" WHERE "signup_sub_statuses"."name" = 'In Progress' AND "signup_sub_statuses"."signup_status_id" = 1 LIMIT 1
CACHE (0.0ms) SELECT "signup_statuses".* FROM "signup_statuses" WHERE "signup_statuses"."code" = 'pending' LIMIT 1
SignupSubStat
@rauxalach
rauxalach / gist:31e5fbaba87d35cf13ff
Created May 6, 2014 13:56
failed to connect PG
chmod 1777 /tmp
service postgresql start
class SmartTableSetting
constructor: (form) ->
@form = $(form)
@columns = @form.find('.column')
@columns.sortable
activate: (event, ui) =>
event.preventDefault
$(this).css "background-color", "#CFCFCF"
@rauxalach
rauxalach / gist:7525222
Created November 18, 2013 09:37
Rails Callback Test
rails g model ABC status:string
rake db:migrate
class Abc < ActiveRecord::Base
before_create :set_status
private
def set_status
status = 'Test'
@rauxalach
rauxalach / gist:7523774
Created November 18, 2013 07:05
Letter CSV Import
class LetterImport < CSVImport
def import(row)
letter = Letter.where(template_name: row[:letter_name]).first_or_initialize
params = {
content: row[:letter_text]
}
if letter.new_record?
params[:created_by] = User.jobready.first
@rauxalach
rauxalach / gist:7364121
Created November 8, 2013 00:09
widgets
- signup_project.rb
scope :by_creator, -> (user) { where(created_by: user.id) }
- widgets/_signup_in_progres.html.haml
= widget 'signups_in_progress' do
%h4 #{icon('file-text')} Signup Projects In Progress (#{SignupProject.by_creator(current_user).count})
* if is standard recommencement
if recommencement date >= 01/07/2012
+ if startdate <= 01/07/2012
recommencementdate + 3.months
+ if startdate > 01/07/2012
recommencementdate + 6.months