This file contains hidden or 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 Module | |
| def access(*args) | |
| args.each do |arg| | |
| instance_var = ("@" + arg.to_s) | |
| define_method(arg.to_s + '=') {|val| instance_variable_set(instance_var, val)} | |
| define_method(arg) { instance_variable_get(instance_var)} | |
| end | |
| end | |
| def attr_access(*args) |
This file contains hidden or 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 | |
| #default_scope where(:banned => false) | |
| scope :unbanned, where(:banned => false) | |
| include ChooseCity | |
| rolify | |
| acts_as_voter | |
| has_karma(:questions, :as => :submitter, :weight => 0.5) | |
| mount_uploader :avatar, AvatarUploader |
This file contains hidden or 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
| namespace :faye_server do | |
| desc "Start faye server" | |
| task :start do | |
| run "cd #{current_path};RAILS_ENV=production bundle exec rackup faye.ru -s thin -E production -D -P tmp/pids/faye.pid" | |
| end | |
| desc "Stop faye server" | |
| task :stop do | |
| run "cd #{current_path};if [ -f tmp/pids/faye.pid ] && [ -e /proc/$(cat tmp/pids/faye.pid) ]; then kill -9 `cat tmp/pids/faye.pid`; fi" | |
| end |
This file contains hidden or 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
| def append_config_to_file | |
| tempfile = File.open("file.rb", 'w') | |
| f = File.new("config/application.rb") | |
| f.each do |line| | |
| tempfile << line | |
| if line.match(/class Application/) | |
| tempfile << " config.autoload_paths += %W(\#{config.root}/searches)\n" | |
| end | |
| end | |
| f.close |
This file contains hidden or 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
| ru: | |
| date: | |
| abbr_day_names: | |
| - Вс | |
| - Пн | |
| - Вт | |
| - Ср | |
| - Чт | |
| - Пт | |
| - Сб |
This file contains hidden or 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
| <body> | |
| <div id="sv-header"> | |
| <div class="sv-wrapper clearfix"> | |
| <div id="sv-search-box"> | |
| <%= render :partial=> 'layouts/sv-search-box' %> | |
| </div> | |
| <div id="sv-sign-box"> | |
| <% if user_signed_in? %> | |
| <div class="sv-logged-box clearfix"> | |
| <div class="avatar"><div class="border"><a href="<%= user_path(current_user) %>"><%= image_tag current_user.avatar %></a></div></div> |
This file contains hidden or 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 Post < ActiveRecord::Base | |
| resourcify | |
| belongs_to :user | |
| belongs_to :journal, :polymorphic => true | |
| has_many :images, :class_name => "PostImage", :as => :imageable, :dependent => :destroy | |
| has_one :illustration, :class_name => "PostIllustration", :as => :imageable, :dependent => :destroy | |
| accepts_nested_attributes_for :illustration | |
| accepts_nested_attributes_for :images,\ |
This file contains hidden or 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
| MacBook-Pro-egor.local:17096 on MESSAGES_QUEUE at just now Retry or Remove | |
| Class | |
| AddImageToMessage | |
| Arguments | |
| 131 | |
| [{"image"=>{"original_filename"=>"kfc.png", "content_type"=>"image/png", "headers"=>"Content-Disposition: form-data; name=\"message[images_attributes][][image]\"; filename=\"kfc.png\"\r\nContent-Type: image/png\r\n", "tempfile"=>["�PNG\r\n", "\u001A\n", "\u0000\u0000\u0000\rIHDR\u0000\u0000\u0000�\u0000\u0000\u0000�\b\u0006\u0000\u0000\u0000�X��\u0000\u0000\u0000\u0006bKGD\u0000�\u0000�\u0000�����\u0000\u0000\u0000\atIME\a�\u0004\u0019\u000F\u0016!7\u0011\u001A-\u0000\u0000 \u0000IDATx���wt\u0014�����m��$��{�]D@\u0001�M�t\u0011\u0005EA�l(XP\u0004\u0015\u0010Q�H���S� �t�\"��P\u0013\b\u0010 !��-3�\u001FK����4\u0012���\u001C�w��\\6������\u001F��\u001Fv\u0011\n", "{\u0000�\u0018\u0001@\t \b�X\u001DK\u0000\u0012��\a?��\u001D�\u007F\u0014\u0004�\t�2��\u0016@#�\u0001P\u001D(\u000F�\\<�\u0000D\u0000\u0017�0�\fp\u0002�\u00170��P�� �O@�h\b�\u0000t�,\u0014b\u0001�#\u00118T]T��Qi���b�\n", "Q� {��\u0013�=$Av\u |
This file contains hidden or 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 AmazonImageUploader | |
| def initialize(id, file) | |
| name = file[0][:image].original_filename | |
| directory = "public/uploads/" | |
| path = File.join(directory, name) | |
| File.open(path, "wb") { |f| f.write(file[0][:image].read) } | |
| @file = path | |
| @id = id | |
| end |
This file contains hidden or 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 MessageImageWorker | |
| @queue = :message_image_queue | |
| def self.perform(message_id, image) | |
| message = Message.find(message_id) | |
| message.images << MessageImage.create!(image: image) | |
| end | |
| end |