Skip to content

Instantly share code, notes, and snippets.

View svenyurgensson's full-sized avatar

Yury Batenko svenyurgensson

View GitHub Profile
@svenyurgensson
svenyurgensson / Gemfile
Created April 19, 2012 12:04 — forked from fxposter/Gemfile
Test environment for rails apps
group :development, :test do
gem 'rspec-rails', '~> 2.9' # rails generate rspec:install
gem 'factory_girl_rails'
end
group :test do
gem 'spork-rails' # spork rspec --bootstrap
gem 'capybara'
gem 'launchy'
gem 'timecop'
@svenyurgensson
svenyurgensson / geoip_service.rb
Created September 5, 2012 05:12 — forked from mislav/geoip_service.rb
Simple GeoIP service class using freegeoip.net and Faraday
require 'faraday_middleware'
require 'hashie/mash'
# Public: GeoIP service using freegeoip.net
#
# See https://github.com/fiorix/freegeoip#readme
#
# Examples
#
# res = GeoipService.new.call '173.194.64.19'
@svenyurgensson
svenyurgensson / easy_way.rb
Created September 5, 2012 05:12 — forked from mislav/easy_way.rb
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end
@svenyurgensson
svenyurgensson / config.ru
Created September 5, 2012 05:16 — forked from mislav/config.ru
Shortest simplest sweetest web "hello {NAME}" in Ruby
run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] }
@svenyurgensson
svenyurgensson / cmd.rb
Created September 5, 2012 05:17 — forked from mislav/cmd.rb
Execute a command, return its output, error stream and exit status
# returns [output string, err string, exit code]
def cmd(args, input = nil)
parent_read, child_write = IO.pipe
err_read, err_write = IO.pipe
child_read, parent_write = IO.pipe if input
pid = fork do
if input
parent_write.close
$stdin.reopen(child_read)
@svenyurgensson
svenyurgensson / Gemfile
Last active December 12, 2015 02:38 — forked from pirj/Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'sinatra-contrib', require: 'sinatra/streaming'
group :development do
gem 'thin'
gem 'pry-rails'
end
# encoding: utf-8
# needs to be installed 7za, pgdbf
namespace :kladr do
PATH = 'tmp/kladr'
def import_options(database=nil)
host = ActiveRecord::Base.configurations[Rails.env]['host']
user = ActiveRecord::Base.configurations[Rails.env]['username']
host &&= "--host=#{host}"

Введение

Начать стоит отсюда. Не пугайтесь то, что это книга по незнакомой 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

Check out README.md to get started editing Clojure with Emacs.