Skip to content

Instantly share code, notes, and snippets.

View artofhuman's full-sized avatar

Semyon Pupkov artofhuman

View GitHub Profile
Hostname:
artofhuman-ubuntu
Message:
undefined method `title' for nil:NilClass
Params:
---
return_to: http://admin.pulscen.dev:3000/deliveries?group=company§ion=auto
action: edit
controller: mail_deliveries/admin/deliveries
id: '12'
@artofhuman
artofhuman / unused_routes.rb
Created May 15, 2016 05:15 — forked from strzibny/unused_routes.rb
Find unused routes in Rails
#!/usr/bin/env ruby
# Extracted from traceroute gem + checking the presence of views as well
require_relative './config/environment.rb'
class Traceroute
def initialize(app)
@app = app
end
# Callback
class Apress::Demands::Tenders::AcceptTender
include Interator
include ActiveSupport::Callbacks
define_callbacks :accept
def call
run_callbacks :accept do
tender.accept!
@artofhuman
artofhuman / gist:5c06ee384d2bab7cc81e
Last active November 19, 2015 07:23
filter rspec backtrace
config.backtrace_exclusion_patterns = [
/\/lib\d*\/ruby\//,
/bin\//,
/gems/,
/spec\/spec_helper\.rb/,
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
=> "SELECT deliveries.id,\n deliveries.title,\n deliveries.description,\n company_sends_log.sent_at,\n companies.id as company_id,\n regions.name as region_name,\n users.email,\n row_number() OVER () AS row_num FROM \"mail_deliveries\".\"company_sends_log\" INNER JOIN \"companies\" ON \"companies\".\"id\" = \"mail_deliveries\".\"company_sends_log\".\"company_id\" INNER JOIN \"company_users\" ON \"company_users\".\"company_id\" = \"companies\".\"id\" INNER JOIN \"users\" ON \"users\".\"id\" = \"company_users\".\"user_id\" INNER JOIN \"regions\" ON \"regions\".\"id\" = \"companies\".\"main_region_id\" INNER JOIN mail_deliveries.deliveries\n ON deliveries.id = company_sends_log.delivery_id LEFT JOIN mail_deliveries.unsubscribed_users ON unsubscribed_users.user_id = users.id WHERE (users.email_is_unreachable != true AND unsubscribed_users.id is NULL) AND (company_sends_log.sent_at >= '2015-07-01') AND (company_sends_log.se
#<BarmenPremiumProductsFinder:0x00000018233760 @rubric_id=10140, @premium_products=[], @region_id=6, @barmen_banners=[#<BarmenClient::Rotating::Banner:0x0000001829eab0 @attributes={"priority"=>1, "uuid"=>"d9cc4a0f-dbb2-4950-84ac-37c6da7ba8c3", "banner_type"=>#<BarmenClient::BannerType:0x0000001829de80 @attributes={"width"=>1, "height"=>1, "slug"=>"premium"}, @persisted=false, @prefix_options={}>, "banner_shape"=>#<BarmenClient::Rotating::Banner::BannerShape:0x0000001829d638 @attributes={"type"=>"BannerShapes::PremiumProduct", "banner_shape_link"=>#<BarmenClient::Rotating::Banner::BannerShape::BannerShapeLink:0x0000001829cd00 @attributes={"uuid"=>"6ea097b1-c911-4550-b971-8c8634f9b8f9", "public_url"=>"http://click.barmen.test-pulscen.ru/link/6ea097b1-c911-4550-b971-8c8634f9b8f9"}, @persisted=false, @prefix_options={}>, "banner_shape_premium_product"=>#<BarmenClient::Rotating::Banner::BannerShape::BannerShapePremiumProduct:0x0000001829c378 @attributes={"product_id"=>34}, @persisted=false, @prefix_options={}>}, @
Redis::CommandError: ERR unknown command 'namespace'
/home/pc/.gem/ruby/1.9/gems/redis-3.0.7/lib/redis/client.rb:97:in `call'
/home/pc/.gem/ruby/1.9/gems/newrelic-redis-1.4.0/lib/newrelic_redis/instrumentation.rb:41:in `block in call_with_newrelic_trace'
/home/pc/.gem/ruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb:73:in `block in trace_execution_scoped'
/home/pc/.gem/ruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer_helpers.rb:82:in `trace_execution_scoped'
/home/pc/.gem/ruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb:71:in `trace_execution_scoped'
/home/pc/.gem/ruby/1.9/gems/newrelic-redis-1.4.0/lib/newrelic_redis/instrumentation.rb:37:in `call_with_newrelic_trace'
/home/pc/.gem/ruby/1.9/gems/redis-3.0.7/lib/redis.rb:2432:in `block in method_missing'
/home/pc/.gem/ruby/1.9/gems/redis-3.0.7/lib/redis.rb:37:in `block in synchronize'
/home/pc/.gem/ruby/1.9/gems/redis-3.0.7/lib/redis.rb:37:in `synchronize'
bgkey = ::BgExecutor::Configuration[:redis][:namespace] + ':bg_executor:jobs_queue'
job_name = 'map_coord'
# Test:
result = []
($redis.llen bgkey).times { |idx| val = ($redis.lindex bgkey, idx).to_s; result << val if val.include?(job_name) }
# And Run:
# ($redis.llen bgkey).times { |idx| val = ($redis.lindex bgkey, idx); $redis.lrem bgkey, 0, val if val.include?(job_name) }
#!/bin/bash
# Update and upgrade packages
sudo apt-get update && sudo apt-get upgrade
# Install postgres 9.3
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
# Having Postgres 9.2 already, this will create database instance configured to run on port 5433
@artofhuman
artofhuman / gist:7fbf3ff318c219e0314c
Created January 8, 2015 11:08
Install postgres on netangels
http://www.postgresql.org/download/linux/debian/
http://en.kioskea.net/faq/809-debian-apt-get-no-pubkey-gpg-error
apt-get install -t wheezy-pgdg postgresql-9.3