Skip to content

Instantly share code, notes, and snippets.

def Fuck
end
@SkyWriter
SkyWriter / gist:1250194
Created September 29, 2011 07:35
RVMRC для внутренних проектов
#!/usr/bin/env bash
if [ -e /etc/production ]; then
# Production machine. Do not change.
environment_id="ree-1.8.7-2011.03@pingwin"
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
then
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
@SkyWriter
SkyWriter / gist:1250202
Created September 29, 2011 07:37
config/setup_load_paths.rb
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
@SkyWriter
SkyWriter / gist:1250250
Created September 29, 2011 08:05
My aliases
alias b='bundle'
alias be='b exec'
alias ber='b exec rake'
alias beu='b exec uniqfrd'
alias bi='b install --path vendor'
alias bil='bi --local'
alias binit='bi && b package && echo '\''vendor/ruby'\'' >> .gitignore'
alias bu='b update'
alias create-repo='touch .gitignore && git add .gitignore && git commit -m '\''Created repo'\'' && git checkout -b develop'
alias g='git'
\alternative
\textbf{Зарегистрироваться.}
\begin{enumerate}
\item[1.] Альтернативный сценарий начинается после п.2 основного сценария.
\item[2.] Пользователь выбирает ``Зарегистрироваться''.
\item[3.] Система перенаправляет пользователя на сайт для регистрации.
\end{enumerate}
\alternative
@SkyWriter
SkyWriter / ruby.patch
Created December 6, 2011 08:02
Патч для ускорения загрузки Rails + твики работы с памятью
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
@SkyWriter
SkyWriter / after_use_heap_tune
Created December 6, 2011 08:04
Установка параметров управления памятью для 1.9.2
#!/bin/bash
case "$rvm_ruby_string" in
*ree*|*ruby-1.9.2*)
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
export RUBY_FREE_MIN=$RUBY_HEAP_FREE_MIN
@SkyWriter
SkyWriter / gist:1619288
Created January 16, 2012 05:58
Порядок выполнения action'ов при загрузке админки
muplugins_loaded
plugins_loaded
sanitize_comment_cookies
setup_theme
load_textdomain
after_setup_theme
load_textdomain
auth_cookie_valid
set_current_user
init
@SkyWriter
SkyWriter / gist:1619290
Created January 16, 2012 05:59
Порядок выполнения action'ов при загрузке главной страницы сайта
muplugins_loaded
plugins_loaded
sanitize_comment_cookies
update_option
update_option__transient_doing_cron
updated_option
set_transient__transient_doing_cron
setted_transient
muplugins_loaded
plugins_loaded
@SkyWriter
SkyWriter / gist:1755112
Created February 6, 2012 21:45
rb-threadframe build failure
$ make
/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o main.o -c main.c
/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o dln.o -c dln.c
/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o dmydln.o -c dmydln.c
/usr/bin/gcc-4.2 -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-s