Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrey Eremin developer88

View GitHub Profile
View Dockerfile
# More docs on Dockerfile syntax => https://docs.docker.com/engine/reference/builder/
# Set proper ruby version from the right image https://hub.docker.com/_/ruby?tab=tags
FROM ruby
WORKDIR /home/app
ENV PORT 3000
EXPOSE $PORT
@developer88
developer88 / gist:440df356c09a6e3eeca3c2404ae1c77d
Last active Jan 17, 2017 — forked from andrzejsliwa/gist:778535
list all available cucumber steps - (rake cucumber:steps)
View gist:440df356c09a6e3eeca3c2404ae1c77d
# based on http://www.natontesting.com/2010/01/11/updated-script-to-list-all-cucumber-step-definitions/
#
desc 'List all defined steps'
task :steps do
require 'hirb'
extend Hirb::Console
puts "CUCUMBER steps:"
puts ""
step_definition_dir = "features/step_definitions"
@developer88
developer88 / e-CloseByProfit.mq4
Last active Jul 11, 2016
e-CloseByProfit.mq4 robot that closes your order when you need to / робот, который закрывает сделки тогда, когда вам это надо
View e-CloseByProfit.mq4
//+----------------------------------------------------------------------------+
//| e-CloseByProfit.mq4 |
//| Ким Игорь В. aka KimIV |
//| http://www.kimiv.ru |
//| |
//| С доработками от: |
//| Андрей Ерёмин |
//| http://aeremin.ru |
//| |
//| |
@developer88
developer88 / related_posts_drento.css
Last active Oct 8, 2016
Contextual Related Posts [WP] style for onceingermany.ru and code.aeremin.ru
View related_posts_drento.css
@developer88
developer88 / deploy.rb
Last active Jun 21, 2018
Deploy phpBB with Mina
View deploy.rb
require 'mina/bundler'
require 'mina/git'
set :application, "forum"
set :domain, '%SERVERNAME%'
set :deploy_to, "%PATH-TO-APPLICATION%"
set :repository, '%REPOSITORY-URL%.git'
set :branch, 'master'
set :login, "%LOGIN%"
@developer88
developer88 / .profile
Last active Mar 2, 2017
Some PostgreSQL snippets
View .profile
alias 'pg_sql_restore'='PGPASSWORD=SOMEPASSWORD psql -cO -U username -d dbname -h localhost -f ' # + set path to backup file
alias 'pg_tar_restore'='PGPASSWORD=SOMEPASSWORD pg_restore -cO -U username -d dbname -h localhost ' # + set path to backup file
@developer88
developer88 / index.html.slim
Last active Aug 29, 2015 — forked from axelav/scrollspy.coffee
SpyOn Directive for AngularJS >= 1.2
View index.html.slim
#root { scroll-spy data-top-buffer="200" }
div spy="profile_info_part"
| Spy on profile info part and add 'active'class to this div
div
a name="profile_info_part" id="profile_info_part"
@developer88
developer88 / csv_export.rb
Last active Jan 1, 2016
Export data to Excel in csv format
View csv_export.rb
# For windows only.
#
csv_string = CSV.generate(col_sep: ";", encoding: 'Windows-1251') do |csv|
csv << "Add some data"
end
send_data(csv_string.encode('Windows-1251'), type: 'text/csv; charset=windows-1251; header=present', disposition: "attachment", filename: "file_to_export.csv")
@developer88
developer88 / .bash_profile
Last active Dec 18, 2015
.bash_profile for Mac OS X
View .bash_profile
# Hack for using proxy on MacOS X
export http_proxy="http://LOGIN:PASSWORD@ADDRESS:PORT"
export ftp_proxy="http://LOGIN:PASSWORD@ADDRESS:PORT"
export FTP_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT"
export HTTP_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT"
export ALL_PROXY="http://LOGIN:PASSWORD@ADDRESS:PORT"
# Aliases
alias curl="curl -x LOGIN:PASSWORD@ADDRESS:PORT"
alias svn=colorsvn
@developer88
developer88 / some_active_admin_resource.rb
Created Mar 5, 2013
Add custom method to export table as CSV file for ActiveAdmin Resource + scope items from filter + save csv file compatible with Russian Microsoft Office Excel
View some_active_admin_resource.rb
filter :reception_reception_date, as: :date_range, label: Reception.human_attribute_name(:reception_date_full)
collection_action :download_report, :method => :get do
services = Service.includes(:order, reception: [{medic: :clinic_medics}]).where{ orders.orderable_id != nil } # necessary model
if params[:q] && params[:q][:reception_reception_date_gte].length > 1
services = services.where("receptions.reception_date >= ?", params[:q][:reception_reception_date_gte])
end
if params[:q] && params[:q][:reception_reception_date_lte].length > 1
services = services.where("receptions.reception_date < ?", params[:q][:reception_reception_date_lte])
end