Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh root@123.123.123.123
Add ssh fingerprint and enter password provided in email
# 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: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
require 'benchmark' | |
N = 1_000_000 | |
puts RUBY_VERSION | |
STR = "[12,23,987,43" | |
Benchmark.bm(7) do |b| | |
b.report('[0]') { N.times { "[12,23,987,43"[0] = '' } } |
/** | |
* | |
* usage: $('#select-container').nested({url:'/path/to/backend/which/returns/options/'}) | |
* | |
*/ | |
(function($){ | |
$.fn.extend({ | |
//pass the options variable to the function | |
nested: function(options) { | |
//Set the default values |
Введение
Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой OS, эти термины практически везде одинаковые и здесь они изложены в понятной для начинающих форме.
http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html
Прочесть нужно треть главы до подраздела "Starting a process", если С не пугает, читайте полностью. После прочтения вы будете понимать, что такое process, thread, mutex, priorites, semaphores, scheduler, contex-switch, kernel states.
Ruby
// this is because of http://stackoverflow.com/questions/4398966/how-can-i-hide-select-options-with-javascript-cross-browser/4423543 | |
(function($){ | |
$.fn.extend({detachOptions: function(o) { | |
var s = this; | |
return s.each(function(){ | |
var d = s.data('selectOptions') || []; | |
s.find(o).each(function() { | |
d.push($(this).detach()); |
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.
# 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 | |
# | |
# SERVER: | |
# /etc/init.d/nginx (1. nginx) | |
# /home/app/public_html/app_production/current (Capistrano directory) | |
# |
require 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db("so_test") | |
end | |
class Client | |
include Mongoid::Document | |
belongs_to :contact | |
field :name, type: String |
# app/constraints/photo_constraint.rb | |
class PhotoConstraint | |
def initialize | |
@types = Photo::TYPES | |
end | |
def self.matches?(request) | |
@types.include?(request.path_parameters[:type]) | |
end | |
end |