Skip to content

Instantly share code, notes, and snippets.


Araslanov Evgeny araslanov-e

  • Russia. Tyumen
View GitHub Profile
View nested.js
* usage: $('#select-container').nested({url:'/path/to/backend/which/returns/options/'})
//pass the options variable to the function
nested: function(options) {
//Set the default values
View database.yml.example mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
# Install the MySQL driver:
# gem install mysql2
# And be sure to use new-style password hashing:
adapter: mysql2
encoding: utf8

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@

Add ssh fingerprint and enter password provided in email

View .tmux.clipboard
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"
View Install_tmux
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using (iTerm has mouse support)
Then install
# More on mouse support
View mongo_test.rb
require 'mongoid'
Mongoid.configure do |config|
config.master ="so_test")
class Client
include Mongoid::Document
belongs_to :contact
field :name, type: String
View 0.
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
# Deployment structure
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

View jquery.detach-select-options.js
// this is because of
$.fn.extend({detachOptions: function(o) {
var s = this;
return s.each(function(){
var d ='selectOptions') || [];
s.find(o).each(function() {
View gist:5260978


Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.

Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.