Skip to content

Instantly share code, notes, and snippets.

View parallel588's full-sized avatar

Maksim Pechnikov parallel588

  • WELLNUTS
  • Tampere
View GitHub Profile
body.active_admin {
form {
#{$all-text-inputs},textarea,select[multiple="multiple"] {
border: 1px solid #c9d0d6; @include rounded(3px); font-size: 1em; outline: none; padding: 5px 5px 7px; margin-bottom: 5px;
}
#{$all-text-inputs-focus},textarea:focus,select[multiple="multiple"]:focus {
border: 1px solid #99a2aa; @include shadow(0, 0, 4px, #99a2aa); @include transition(border, linear, 0.2s); @include transition(box-shadow, linear, 0.2s);
}
select[multiple="multiple"] { min-width: 200px;}
}

Введение

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

require 'active_support/basic_object'
ActiveRecord::Base.class_eval do
class WithoutCallbacks < ActiveSupport::BasicObject
def initialize(target, types)
@target = target
@types = types
end
def respond_to?(method, include_private = false)
@parallel588
parallel588 / gist:4745861
Last active December 12, 2015 08:39
Memory storage on PostgreSQL
#!/bin/sh
# Mount ramfs:
umount /mnt/ramfs
if [ ! -d /mnt/ramfs ]; then
mkdir -p /mnt/ramfs
fi
mount -t ramfs none /mnt/ramfs
# Create PostgreSQL tablespace directory:
for f in *.scss; do sass-convert -F scss -T sass $f ${f%%.*}.sass; done
---
rackup: /xapit.ru
chdir: /app
environment: production
address: 0.0.0.0
port: 9293
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
@parallel588
parallel588 / gist:4094537
Created November 17, 2012 09:42
email benchmark
require 'benchmark'
require "pony-express"
require 'net/smtp'
BOUNDARY = Time.now.to_i.to_s
headers =<<EOF
From: xxx@gmail.com
Subject: Hello Mr.Burns
To: xxx2@gmail.com
require 'benchmark'
n = 1000
Benchmark.bm do |x|
x.report {
n.times do |j|
Item.all(:conditions => {:id => with}, :order => "FIELD(id, #{with.join(',')})")
end
}
end
@parallel588
parallel588 / avatar_uploader.rb
Created July 5, 2012 11:05 — forked from kirs/avatar_uploader.rb
Validation of image dimensions with CarrierWave
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# Override the directory where uploaded files will be stored.
<div style="text-align: center">
<script type="text/javascript" src="http://www.kaltura.com/p/874892/sp/87489200/embedIframeJs/uiconf_id/7218852/partner_id/874892"></script><object id="kaltura_player_1337705630" name="kaltura_player_1337705630" type="application/x-shockwave-flash" allowfullscreen="true" allownetworking="all" allowscriptaccess="always" height="450" width="500" bgcolor="#000000" xmlns:dc="http://purl.org/dc/terms/" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://www.kaltura.com/index.php/kwidget/cache_st/1337705630/wid/_874892/uiconf_id/7218852/entry_id/1_ftzarkdi" data="http://www.kaltura.com/index.php/kwidget/cache_st/1337705630/wid/_874892/uiconf_id/7218852/entry_id/1_ftzarkdi"><param name="allowFullScreen" value="true"><param name="allowNetworking" value="all"><param name="allowScriptAccess" value="always"><param name="bgcolor" value="#000000"><param name="flashVars" value="&amp;{FLAVOR}"><param name="movie" value="http://www.kaltura.com/index.ph