This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewMsisdnInUseError < Error; | |
def initialize(msg, models:) | |
super msg | |
@models = models | |
end | |
def inspect | |
Object.instance_method(:inspect).bind(self).call | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../spec_helper' | |
class Foo | |
def self.per_page | |
10 | |
end | |
end | |
describe Foo do | |
should_have_per_page 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
acts_as_authentic | |
attr_accessor :old_password | |
validates_each :old_password, :on => :update, :if => :crypted_password_changed? do |record, attr, old_password| | |
unless (old_password.nil? || record.valid_old_password?(old_password)) | |
record.errors.add attr, self.acts_as_authentic_config[:old_password_did_not_match_message] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Element.addMethods({ | |
pngFix: function(el) { | |
var el = $(el); | |
if (!(Prototype.Browser.IE && el.match('img') && el.src.include('png'))) return el; | |
var src = el.src; | |
var style = {height: el.height, width: el.width} | |
var filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src+'",sizingMethod="scale")'; | |
el.src = '/images/pixel.gif'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in /home/gva/bookfeed) | |
users GET /users {:controller=>"users", :action=>"index"} | |
POST /users {:controller=>"users", :action=>"create"} | |
new_user GET /users/new {:controller=>"users", :action=>"new"} | |
edit_user GET /users/:id/edit {:controller=>"users", :action=>"edit"} | |
user GET /users/:id {:controller=>"users", :action=>"show"} | |
PUT /users/:id {:controller=>"users", :action=>"update"} | |
DELETE /users/:id {:controller=>"users", :action=>"destroy"} | |
user_reviews GET /users/:user_id/reviews {:controller=>"reviews", :action=>"index"} | |
user_event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23:36 gva@saturn:~/avatator>>rake routes | grep -v format | |
(in /home/gva/avatator) | |
avatars GET /avatars {:controller=>"avatars", :action=>"index"} | |
POST /avatars {:controller=>"avatars", :action=>"create"} | |
new_avatar GET /avatars/new {:controller=>"avatars", :action=>"new"} | |
edit_avatar GET /avatars/:id/edit {:controller=>"avatars", :action=>"edit"} | |
avatar GET /avatars/:id {:controller=>"avatars", :action=>"show"} | |
PUT /avatars/:id {:controller=>"avatars", :action=>"update"} | |
DELETE /avatars/:id {:controller=>"avatars", :action=>"destroy"} | |
causes GET /causes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="follow_toggler"> | |
<%= link_to_remote "следить", | |
:url => user_follows_path(current_user.login, :target=>target_user.login) , | |
:method => :post, | |
:success => "$('unfollow_action').hide();$('follow_action').show();", | |
:html => { :id => "unfollow_action", :class => "follow", :style => already_follow ? "display:none;" : "" } %> | |
<%= link_to_remote "не следить", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :application, "avatator" | |
set :deploy_to, "/home/gva/#{application}" | |
set :deploy_via, :remote_cache | |
set :scm, "git" | |
set :repository, "git@github.com:gumayunov/avatator.git" | |
set :git_enable_submodules, 1 | |
#set :gateway, 'unix.sk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(contacts). | |
-export([resources/0, filters/0, contacts/4, contacts/3]). | |
-behaviour(controller). | |
resources() -> | |
[ | |
#resources{ | |
path = {users, contacts}, |
OlderNewer