Skip to content

Instantly share code, notes, and snippets.

View dmitry-ilyashevich's full-sized avatar

Dzmitry Ilyashevich dmitry-ilyashevich

View GitHub Profile
class KoModel
indexed_error_for: (property_name, index, nested_property = null) =>
ko.computed =>
return unless @errors() and error_property = @errors()[property_name]
error = jQuery.grep error_property, (item) ->
item.index == index
return '' unless error and error.length
Resque::Worker.working.each{ |worker| worker.done_working }
ack "search text" -l --print0 | xargs -0 -n 1 sed -i "s/search text/replacement text/"
@dmitry-ilyashevich
dmitry-ilyashevich / ppa_keys.sh
Created March 3, 2013 16:25
Add missing ppa gpg pubkeys
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [PUBKEY_FINGERPRINTS]
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
gem install bundler
# 1. Get edge Rails source (master branch)
git clone https://github.com/rails/rails.git
@dmitry-ilyashevich
dmitry-ilyashevich / nokogiri libxml homebrew lion
Created September 7, 2012 21:55 — forked from devpuppy/nokogiri libxml homebrew lion
How to fix: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
libxml_ruby.bundle: dlsym(0x10fde1900, Init_libxml_ruby): symbol not found
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@dmitry-ilyashevich
dmitry-ilyashevich / deploy.rb
Created July 5, 2012 10:59 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Capistrano configuration
#
# require 'new_relic/recipes' - Newrelic notification about deployment
# require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production.
# set :deploy_via, :remote_cache - fetch only latest changes during deployment
# set :normalize_asset_timestamps - no need to touch (date modification) every assets
# "deploy:web:disable" - traditional maintenance page (during DB migrations deployment)
# task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP
@dmitry-ilyashevich
dmitry-ilyashevich / vim7.3_mac_install.rb
Created July 4, 2012 20:39 — forked from AdrienGiboire/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end