Skip to content

Instantly share code, notes, and snippets.

View araslanov-e's full-sized avatar

Araslanov Evgeny araslanov-e

  • Russia. Tyumen
View GitHub Profile
@araslanov-e
araslanov-e / gist:6130212
Created August 1, 2013 10:27
Dashboard::DashboardController.ancestors => [Dashboard::DashboardController, Dashboard::ApplicationController, ApplicationController, ... ] Member::MemberController.ancestors => [Member::MemberController, ApplicationController, ... ]
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery
end
# app/controllers/dashboard/application_controller.rb
module Dashboard
class ApplicationController < ::ApplicationController
before_filter :authenticate_user!
end
@araslanov-e
araslanov-e / gist:6130213
Created August 1, 2013 10:27
Dashboard::DashboardController.ancestors => [Dashboard::DashboardController, Dashboard::ApplicationController, ApplicationController, ... ] Member::MemberController.ancestors => [Member::MemberController, ApplicationController, ... ]
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery
end
# app/controllers/dashboard/application_controller.rb
module Dashboard
class ApplicationController < ::ApplicationController
before_filter :authenticate_user!
end
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@araslanov-e
araslanov-e / gist:6445658
Created September 5, 2013 03:17
Сервис КЛАДР (http://kladr-api.ru/) совместно с Select2 (http://ivaynberg.github.io/select2/)
$("#street").select2
minimumInputLength: 1
ajax:
url: 'http://kladr-api.ru/api.php'
dataType: 'jsonp'
data: (term, page) ->
token: 'token'
key: 'key'
cityId: 'cityId'
query: term
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"
@araslanov-e
araslanov-e / events_helper_test.rb
Created December 13, 2013 04:56
Тест скорости генерации URL
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')
end
def test_url_for
n = 10000
Benchmark.bmbm do |x|
@araslanov-e
araslanov-e / benchmark_methods.rb
Last active March 17, 2019 09:47
Ruby: class methods vs. instance methods
require "benchmark/memory"
class A
def self.class_method
puts 'hello'
end
def instance_method
puts 'hello'
end
end