Skip to content

Instantly share code, notes, and snippets.

require "action_view/template"
require "redcarpet"
module MerbHandler
mattr_accessor :processing_options, :renderer
@@processing_options = {}
@@renderer = Redcarpet::Render::XHTML
class Handler
def erb_handler

Введение

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

Pry.prompt = [Proc.new{ |obj, nest_level| "#{RUBY_VERSION}-#{RUBY_PATCHLEVEL} (#{obj}):#{nest_level} > " },
Proc.new{ |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " } ]
cmd_aliases = {
'continue' => 'c',
'step' => 's',
'next' => 'n'
}
cmd_aliases.each do |_cmd, _alias|
Pry.commands.alias_command _alias, _cmd if Pry.commands[_cmd]

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@ingeniarius
ingeniarius / index.html
Created March 18, 2013 05:33
HTML5 template
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<link rel="stylesheet" href="">
</head>
<body>
<script src=""></script>
@ingeniarius
ingeniarius / mysql_to_postgres.rb
Created February 22, 2013 15:13
Migrate data from MySQL to PostgreSQL using ActiveRecord Based on https://github.com/braintree/mysql_to_postgresql
#!/usr/bin/env ruby
require 'logger'
require 'active_record'
require 'active_record/base'
require 'active_support'
ActiveRecord::Base.logger = Logger.new("log/mysql_to_postgresql.log")
PROCESSES = 8
@ingeniarius
ingeniarius / build_gemtags
Created November 27, 2012 13:02
Build the whole Ruby Gems ctags file for application
ruby -e "require 'bundler';paths = Bundler.load.specs.map(&:full_gem_path);system(%Q[ctags -R -f .gemtags #{paths.join(' ')}])"
@ingeniarius
ingeniarius / Makefile
Created October 12, 2012 09:21
Makefile for SPIM S20 MIPS Simulator
#
# SPIM S20 MIPS Simulator.
# Makefile for SPIM.
#
# SPIM is covered by a BSD license.
#
# Copyright (c) 1990-2010, James R. Larus.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
@ingeniarius
ingeniarius / dance.rb
Created September 24, 2012 13:38 — forked from ernie/dance.rb
Dependency Injection
#!/usr/bin/env ruby
require './dancer'
require './gangnam_style'
dancer = Dancer.new('PSY', GangnamStyle.new)
dancer.dance!
@ingeniarius
ingeniarius / raskell.rb
Created August 16, 2012 18:34 — forked from andkerosine/raskell.rb
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@