start new:
tmux
start new with session name:
tmux new -s myname
Around('@javascript', '@slow') do |scenario, block| | |
Capybara.default_wait_time = 10 | |
block.call | |
Capybara.default_wait_time = 2 | |
end |
# Simple JOIN | |
User.joins(:account) # User -> Account | |
# Will produce | |
# SELECT `users`.* FROM `users` INNER JOIN `accounts` ON `accounts`.`user_id` = `users`.`id` | |
# Complicated JOIN | |
Trait.joins(:user => :account) # Trait -> User -> Account | |
# Will produce | |
# SELECT `traits`.* FROM `traits` INNER JOIN `users` ON `users`.`id` = `traits`.`user_id` INNER JOIN `accounts` ON `accounts`.`user_id` = `users`.`id` |
# Index | |
--------------------------------------------------------------------- | |
curl -XPUT http://localhost:9200/pictures/ -d ' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"index_analyzer": { | |
"tokenizer": "standard", |
require "money" | |
class Decorator < BasicObject | |
undef_method :== | |
def initialize(component) | |
@component = component | |
end | |
def method_missing(name, *args, &block) |
YaAcl::Builder.build do | |
roles do | |
role :admin, :name => 'Администратор' | |
role :remote_operator, :name => 'Удаленный Оператор' | |
role :editor, :name => 'Редактор' | |
role :taxonom, :name => 'Таксоном' | |
role :operator, :name => 'Оператор' | |
role :solo_operator, :name => 'Соло Оператор' | |
role :transcripter, :name => 'Транскриптер' | |
role :transcripts_editor, :name => 'Редактор транскриптов' |
module AccessHelper | |
include AuthHelper | |
def check_access(values = {}) | |
acl.check! self.class.to_s, self.action_name, current_roles, values | |
end | |
def current_roles | |
@current_roles ||= current_user.roles_hash.keys | |
end |
function resolveURL(baseURL, relativeURL) { | |
var html = document.implementation.createHTMLDocument(""); | |
var base = html.createElement("base"); | |
base.setAttribute("href", baseURL); | |
var a = html.createElement("a"); | |
a.setAttribute("href", relativeURL); | |
html.head.appendChild(base); | |
html.body.appendChild(a); | |
return a.href; | |
} |
require "errors" | |
class FacebookService | |
class << self | |
def register(data_hash) | |
data = AuthData.new(data_hash) | |
auth = User::Facebook.find_by_uid(data.uid) | |
if auth | |
raise UserBlockedError if auth.user.blocked? |
$('form').on('change', '.image_preview input[type="file"]', function(e) { | |
var files = e.target.files, | |
f = files[0], | |
reader = new FileReader(), | |
t = this | |
; | |
reader.onload = (function(file) { |