Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
orbanbotond / Git commands
Last active June 18, 2019 10:08
Git commands
List Branches Merged into a Target Branch
git branch --merged <Target Branch name>
See the changes of a file:
git log -p <path_to_the_file>
Apply patch:
git am
Creating patch:
# Build Notes
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.1/static/install-procedure.html
@orbanbotond
orbanbotond / gist:2851253
Created June 1, 2012 11:06
Omniauth resources
https://developers.facebook.com/apps
Migrating data between plans:
https://devcenter.heroku.com/articles/migrating-data-between-plans
postgresql
https://devcenter.heroku.com/articles/heroku-postgresql
@orbanbotond
orbanbotond / Question for an interview
Created September 10, 2012 11:57
Question for an interview
module SolrFilter
module ClassMethods
def do_guess_what(*args)
args.each do |arg|
define_method "#{arg.to_s}_solr_filtered" do
send(arg).gsub /\'/, ''
end
end
end
end
@orbanbotond
orbanbotond / gist:3906179
Created October 17, 2012 15:33
item removal
sale = Sale.new
Item.where("brand LIKE '%Barney%'").where(:deleted_at => nil).each do |item|
doc1 = AWSCloudSearch::Document.new(true)
doc1.id = item.id
sale.destroy_doc(doc1)
item.deleted_at = Time.now
item.save
end
sale.flush_batch
@orbanbotond
orbanbotond / spec_helper.rb
Created November 20, 2012 15:59 — forked from sethbro/spec_helper.rb
Rails unit, functional and integration tests in Minitest spec format.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'action_controller/test_case'
require 'miniskirt'
require 'capybara/rails'
@orbanbotond
orbanbotond / gist:5160018
Created March 14, 2013 09:23
Postgress DB migration
ssh -i ~/.ec2/gsg-keypair root@54.244.154.184
pg_dump -a -F c -U search_server search_server_production > db.out
scp -i ~/.ec2/gsg-keypair root@54.244.154.184:/mnt/search_server-production/current/db.out db.out
scp -i ~/.ec2/gsg-keypair db.out root@54.244.133.93:/mnt/search_server_staging-production/current/db.out
pg_restore -a -d search_server_staging_production -U search_server_st db.out
@orbanbotond
orbanbotond / routes.rb
Created June 3, 2013 08:36
authentication constrained routes
constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? }
constraints constraint do
mount Sidekiq::Web, :at => '/admin/sidekiq'
end
@orbanbotond
orbanbotond / elastic
Created June 7, 2013 14:43
elastic_search_dsl
aliases = Tire::Configuration.client.get(Tire::Configuration.url + '/_aliases').body
prod = Product.create long_description: 'alma'
price1 = Price.new price:1, agreement_id:1
price2 = Price.new price:2, agreement_id:2
prod.prices<< price1
prod.prices<< price2
prod.tire.update_index
prod.touch