Skip to content

Instantly share code, notes, and snippets.

View joxxoxo's full-sized avatar

Andrei Razhkouski joxxoxo

View GitHub Profile
@joxxoxo
joxxoxo / sample.csv
Created January 4, 2017 12:36
sample.csv
Dallas 47 Janet Fuller 445 Upland Pl. Trial
Lyon 38 Andrew Heiniger 347 College Av. Active
Dallas 43 Susanne Smith 2 Upland Pl. Active
Berne 22 Bill Ott 250 - 20th Ave. Active
Boston 32 Michael Ott 339 College Av. Trial
Dallas 4 Sylvia Ringer 365 College Av. Active
Boston 23 Julia Heiniger 358 College Av. Active
Chicago 39 Mary Karsen 202 College Av. Active
Dallas 40 Susanne Miller 440 - 20th Ave. Trial
Berne 9 James Schneider 277 Seventh Av. Active
setw -g mode-keys vi
unbind C-b
set -g prefix M-a
bind M-a send-prefix
set -sg escape-time 0
bind -n M-h select-pane -L
bind -n M-j select-pane -D
@joxxoxo
joxxoxo / setup_work_env.sh
Last active August 29, 2015 14:05
Script to setup dev environment
#!/bin/bash
set -e
# requirements
sudo apt-get install -y aptitude
sudo aptitude update && sudo aptitude upgrade
sudo aptitude -y install mysql-server subversion git curl libmysqlclient-dev \
build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev \
libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \
@joxxoxo
joxxoxo / run_for_each_revision_in_master.sh
Created June 25, 2014 09:22
execute command for each revision in branch (do not count separate commits that were merged)
#!/bin/bash
(
base_dir=~/repo
cd $base_dir
# To test
# git reset master~10 --hard
git reset --hard
@joxxoxo
joxxoxo / logrotate
Created September 27, 2013 07:41
logrotate
<%= shared_path %>/log/<%= rails_env %>.log {
rotate 3
weekly
minsize 1M
missingok
copytruncate<%#create 664 <%= "#{user} #{user}" %>
notifempty
compress
delaycompress
}
@joxxoxo
joxxoxo / deploy.sh
Last active December 18, 2015 12:10
deploy script
#!/usr/bin/env bash
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
@joxxoxo
joxxoxo / jenkins_example.sh
Last active December 18, 2015 12:10
jenkins_example
#!/bin/bash -x
source /var/lib/jenkins/.bash_profile
source /var/lib/jenkins/.bashrc
rvm use 1.9.3-p194-railsexpress@qwerty --create
bundle install
read -d '' database_yml <<"EOF"
login: &login
adapter: mysql2
username: "foo"
password: "bar"
@joxxoxo
joxxoxo / db.rake
Created May 23, 2013 21:31
to load seeds when test db recreated
db_namespace = namespace :db do
namespace :test do
# desc "Recreate the test database from a fresh schema.rb file"
task :clone => %w(db:schema:dump db:test:load_schema db:test:load_required_seeds)
# desc "Recreate the test database from a fresh structure.sql file"
task :clone_structure => [ "db:structure:dump", "db:test:load_structure", "db:test:load_required_seeds"]
desc 'Check for pending migrations and load the test schema, then load seeds'
@joxxoxo
joxxoxo / spec_helper.rb
Created May 23, 2013 07:18
Single AR db connection for test
#Capybara use the same connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
module Search
class Search
class << self
def perform(*args)
results = nil
with_exception_handling { results = perform_without_rescue(*args) }
::Search::SearchResults.new(results)
end
def perform_without_rescue(search_params, *classes)