Skip to content

Instantly share code, notes, and snippets.

View kzaitsev's full-sized avatar

Kirill Zaitsev kzaitsev

  • Limassol, Cyprus
View GitHub Profile
bugagazavr@kirill-pc ~/Ruby/teobit (master●●●●)$ rails c [ruby-2.1.0]
MiniTest::Unit::TestCase is now Minitest::Test. From /home/bugagazavr/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
Loading development environment (Rails 4.1.0.beta1)
2.1.0 :001 > h = {:body=>"[{\"hash\": \"ce57f8c0298ccef30834b4211c2cce05\", \"last_modified\": \"2014-01-15T19:06:25.171580\", \"bytes\": 326251, \"name\": \"assets/portfolio/yakimanka/big-b98fe3cc2755fd1e4a555df5daf29501.png\", \"content_type\": \"image/png\"}, {\"hash\": \"ceda121d33a60bd23c13d76684eb0703\", \"last_modified\": \"2014-01-15T19:06:25.405910\", \"bytes\": 21918, \"name\": \"assets/portfolio/yakimanka/graphics/attendance-cad26723da5b872a5dfd6c0787f0ee65.png\", \"content_type\": \"image/png\"}, {\"hash\": \"02e4b3bf43a5a07267ca23e4304f4b9f\", \"last_modified\": \"2014-01-15T19:06:25.697320\", \"bytes\": 11058, \"name\": \"assets/portf
bugagazavr@Kirills-Mac-Pro ~/Documents/Ruby/teobit_fog (master●●)$ bundle exec rake assets:precompile
MiniTest::Unit::TestCase is now Minitest::Test. From /Users/bugagazavr/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
[fog][WARNING] PATCHING Fog::Storage::OpenStack to added debugging information to JSON decoding
cp public/assets/chosen-sprite-d097caf71641f3afb04998af85b36b33.png public/assets/chosen-sprite.png
cp public/assets/chosen-sprite-fa9df9bbee9f1ab89799379cb153636e.png public/assets/chosen-sprite.png
cp public/assets/chosen-sprite@2x-5975a8658625306b2570c7c4146f8595.png public/assets/chosen-sprite@2x.png
cp public/assets/chosen-sprite@2x-f574a81d811e99d629b5b35cbfee5dae.png public/assets/chosen-sprite@2x.png
[fog][WARNING] Unrecognized arguments: region
[/awesome] empty? true parse_json: true type:
rake aborted!
bugagazavr@Kirills-Mac-Pro ~/Documents/Ruby/teobit_fog (master●●)$ bundle exec rake assets:precompile
MiniTest::Unit::TestCase is now Minitest::Test. From /Users/bugagazavr/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
[fog][WARNING] PATCHING Fog::Storage::OpenStack to added debugging information to JSON decoding
cp public/assets/chosen-sprite-d097caf71641f3afb04998af85b36b33.png public/assets/chosen-sprite.png
cp public/assets/chosen-sprite-fa9df9bbee9f1ab89799379cb153636e.png public/assets/chosen-sprite.png
cp public/assets/chosen-sprite@2x-5975a8658625306b2570c7c4146f8595.png public/assets/chosen-sprite@2x.png
cp public/assets/chosen-sprite@2x-f574a81d811e99d629b5b35cbfee5dae.png public/assets/chosen-sprite@2x.png
[fog][WARNING] Unrecognized arguments: region
[/awesome] empty? true parse_json: true type:
[/awesome] content-type: ''
@kzaitsev
kzaitsev / schedule.rb
Created February 10, 2014 21:37
sochi 2014
require 'nokogiri'
require 'excon'
require 'active_support/time'
require 'pp'
sch = []
(2..17).each do |day|
day_of_month = day + 6
response = Excon.get("http://www.sochi2014.com/ezhednevnoe-raspisanie-den-#{day}")
page = Nokogiri::HTML(response.body)
module Slugeable
extend ActiveSupport::Concern
included do
extend FriendlyId
friendly_id :slug_candidates, use: :slugged
def slug_candidates
if defined?(self.posted_at)
"#{posted_at}-#{name}"
$ cat /var/log/upstart/drone.log
2014/04/06 15:04:10 Database already up-to-date.
2014/04/06 15:04:10 starting drone version 2a009fa on port :8081
2014/04/06 20:03:56 Database already up-to-date.
2014/04/06 20:03:56 starting drone version 2a009fa on port :8081
2014/04/06 20:05:20 Database already up-to-date.
2014/04/06 20:05:20 starting drone version 2a009fa on port :8081
2014/04/06 20:11:11 error updating github status: Not Found
starting service container bradrydzewski/postgres:9.1
creating build image
Program.all.each do |p|
p.update_attribute(:hours, "до 8 часов") if p.hours.blank?
p.update_attribute(:peoples, "до 300 человек") if p.peoples.blank?
end
namespace :deploy do
before 'deploy:assets:precompile', :clean_css_cache do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
if test("[ -d #{shared_path}/tmp/cache/assets ]")
if test("[ -d #{shared_path}/tmp/cache/assets/production ]")
if test("[ -d #{shared_path}/tmp/cache/assets/production/sprockets ]")
out = capture("grep -r -l 'application.css' #{shared_path}/tmp/cache/assets/production/sprockets/")
out.split("\n").each do |o|
execute :rm, o.gsub("\r", '').to_s
@kzaitsev
kzaitsev / example.rb
Last active August 29, 2015 14:02
example.rb
hash = {lists: @lists}
hash.merge!(default: @lists.index(@default_list)) if @default_list
hash.to_json
if ENV['RAILS_ENV'] == 'production'
puts "USING PATCHED CARRIERWAVE"
module CarrierWave
module Uploader
module Url
def url(options = {})
if file.respond_to?(:path)