Skip to content

Instantly share code, notes, and snippets.

@yury
yury / file1.txt
Created April 13, 2013 17:24
new
werwerw
@yury
yury / markdown.md
Created April 9, 2013 20:37
test gist

привет

require 'benchmark'
def byte_can_encode(str)
str.each_char do |c|
# simple range checks for most common characters (' '..'_') or ('a'..'~')
b = c.getbyte(0)
unless b >= 0x20 && b <= 0x5F || b >= 0x61 && b <= 0x7E
return false
end
end
@yury
yury / gist:5028804
Created February 25, 2013 09:50
rbenv os x readline and O2 optimization
env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.0.0-p0
@yury
yury / Coffeescript ctags
Created May 6, 2012 22:51 — forked from AndrewRadev/Coffeescript ctags
ctags definitions for coffeescript. Detects classes, static/class methods, plain functions and variables.
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z]+\.)*([A-Za-z]+)( extends [A-Za-z.]+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?([A-Za-z.]+):.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
╭─yury@airbot ~/Work/deck ‹ruby-1.9.3› ‹master*›
╰─$ rake 1 ↵
Build ./build/iPhoneSimulator-5.1-Development
rake aborted!
can't convert Pathname into String
Tasks: TOP => default => simulator => build:simulator
(See full trace by running task with --trace)
@yury
yury / rake
Created May 5, 2012 15:43
JSONKit dependency error
╭─yury@airbot ~/Work/deck ‹ruby-1.9.3› ‹master*›
╰─$ rake
Build ./build/iPhoneSimulator-5.1-Development
rake aborted!
can't convert Pathname into String
Tasks: TOP => default => simulator => build:simulator
(See full trace by running task with --trace)
# Sample configuration file for Unicorn (not Rack)
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
RAILS_ENV = 'development'
RAILS_ROOT = File.expand_path('../..', __FILE__)
# Use at least one worker per core if you're on a dedicated server,
# more will usually help for _short_ waits on databases/caches.
worker_processes RAILS_ENV == 'production' ? 6 : 1
rvm use ruby-1.9.3-p0-new_hash2
which ruby
/Users/yury/.rvm/rubies/ruby-1.9.3-p0-new_hash2/bin/ruby
/usr/bin/time -l rspec spec/models/import_spec.rb
61.94 real 63.29 user 1.42 sys
184184832 maximum resident set size
0 average shared memory size
0 average unshared data size
@yury
yury / gist:1533864
Created December 29, 2011 12:30
bench
rvm install 1.9.3-p0 -n new_hash --patch `curl -O -s -w "hash_optimize.patch" https://raw.github.com/gist/1509477/0ce84bfa6464a87eba8ef083f8f0290d98e67a05/hash_optimize.patch`
rvm 1.9.3-p0-new_hash
which ruby
/Users/yury/.rvm/rubies/ruby-1.9.3-p0-new_hash/bin/ruby
82.02 real 83.01 user 1.61 sys
204537856 maximum resident set size
0 average shared memory size