Skip to content

Instantly share code, notes, and snippets.

[BUG] Segmentation fault
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
-- Control frame information -----------------------------------------------
c:0007 p:---- s:0021 b:0021 l:000020 d:000020 CFUNC :next!
c:0006 p:0049 s:0018 b:0018 l:000017 d:000017 METHOD /Users/ptico/.rvm/gems/ruby-1.9.3-p0/gems/data_objects-0.10.7/lib/data_objects/reader.rb:35
c:0005 p:---- s:0014 b:0014 l:000013 d:000013 FINISH
c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :to_a
c:0003 p:0087 s:0009 b:0008 l:001638 d:002478 EVAL do.rb:8
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
@Ptico
Ptico / spec.rb
Created October 7, 2011 15:30
Rspec functioning principle
# Core
class Object
def should(matcher)
puts matcher.match(self)
end
end
class Matcher
def initialize(expected, &block)
@expected = expected
require 'resque/tasks'
task "resque:setup" => :environment
namespace :queue do
task :start => :environment do
pidfile = Rails.root.join('tmp', 'pids', 'resque.pid')
logfile = Rails.root.join('log', 'resque.log')
errlogfile = Rails.root.join('log', 'resque_errors.log')
@Ptico
Ptico / ruby-1.9-tips.rb
Created February 27, 2011 22:18 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 tips and tricks
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
# cap web:deploy:desable & cap web:deploy:enable
server {
...
if (-f $document_root/system/maintenance.html) { set $maintenance 1; }
if ($request_uri ~* (jpg|jpeg|gif|js|css)$) { set $maintenance 0; }
if ($maintenance) { rewrite ^(.*)$ /system/maintenance.html; break; }
...
}
@Ptico
Ptico / SassMeister-input.scss
Last active August 29, 2015 14:25
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.pretty-form {
input {
&[type="text"], &[type="password"], &[type="email"], &[type="url"], &[type="month"], &[type="number"], &[type="search"], &[type="tel"], &[type="week"] {
&:invalid, .invalid & {
color: red;
}
@Ptico
Ptico / 1_instructions.md
Created June 18, 2015 18:13
Список журналажи и тотальной зрады (пополняется)

Следуя данной инструкции вы избавитесь от паники, тотальной зрады, а так же улучшите настроение и аппетит.

Если у вас windows 8 и выше

  1. Читаете как править файл hosts здесь: http://skesov.ru/kak-izmenit-fayl-hosts-na-windows-8-1-ili-8/
  2. Вставляете в конец файла записи из списка ниже
  3. Сохраняете

Если у вас MacOS X или Linux

class A
attr_accessor :foo
def initialize
@mutex = Mutex.new
end
def perform
t1 = Thread.new do
@foo ||= 10
.demo {
position: static;
display: block;
float: left;
clear: both;
box-sizing: border-box;
left: 0;
@Ptico
Ptico / bench.txt
Last active August 29, 2015 14:10
Before:
user system total real
camelize 1.090000 0.120000 1.210000 ( 1.209177)
underscore 1.280000 0.130000 1.410000 ( 1.421322)
dasherize 0.540000 0.070000 0.610000 ( 0.605857)
demodulize 0.370000 0.050000 0.420000 ( 0.420292)
foreign_key 1.020000 0.080000 1.100000 ( 1.103289)
ordinalize 3.570000 0.230000 3.800000 ( 3.809217)
pluralize 5.000000 0.110000 5.110000 ( 5.113936)