Skip to content

Instantly share code, notes, and snippets.


Araslanov Evgeny araslanov-e

  • Russia. Tyumen
View GitHub Profile
araslanov-e / benchmark_methods.rb
Last active Mar 17, 2019
Ruby: class methods vs. instance methods
View benchmark_methods.rb
require "benchmark/memory"
class A
def self.class_method
puts 'hello'
def instance_method
puts 'hello'
View nested.js
* usage: $('#select-container').nested({url:'/path/to/backend/which/returns/options/'})
//pass the options variable to the function
nested: function(options) {
//Set the default values
araslanov-e / benchmark.rb
Created Mar 11, 2014
The fastest and most readable way to remove the first character from a string
View benchmark.rb
require 'benchmark'
N = 1_000_000
STR = "[12,23,987,43" do |b|'[0]') { N.times { "[12,23,987,43"[0] = '' } }
View database.yml.example mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
# Install the MySQL driver:
# gem install mysql2
# And be sure to use new-style password hashing:
adapter: mysql2
encoding: utf8

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@

Add ssh fingerprint and enter password provided in email

araslanov-e / events_helper_test.rb
Created Dec 13, 2013
Тест скорости генерации URL
View events_helper_test.rb
class EventsHelperTest < ActionView::TestCase
def setup
country = Country.create(name: 'Belarus')
state = State.create(name: 'Minsk')
@event = Event.create(country: country, state: state, name: 'Drinking bear')
def test_url_for
n = 10000
Benchmark.bmbm do |x|
View .tmux.clipboard
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"
araslanov-e / gist:6445658
Created Sep 5, 2013
Сервис КЛАДР ( совместно с Select2 (
View gist:6445658
minimumInputLength: 1
url: ''
dataType: 'jsonp'
data: (term, page) ->
token: 'token'
key: 'key'
cityId: 'cityId'
query: term
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using (iTerm has mouse support)
Then install
# More on mouse support
araslanov-e / gist:6130213
Created Aug 1, 2013
Dashboard::DashboardController.ancestors => [Dashboard::DashboardController, Dashboard::ApplicationController, ApplicationController, ... ] Member::MemberController.ancestors => [Member::MemberController, ApplicationController, ... ]
View gist:6130213
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
# app/controllers/dashboard/application_controller.rb
module Dashboard
class ApplicationController < ::ApplicationController
before_filter :authenticate_user!