This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'yaml' | |
require 'active_record' | |
require 'sanitize' | |
ActiveRecord::Base.establish_connection(YAML::load(File.open("./database.yml"))['production']) | |
class Manufacturer < ActiveRecord::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dir1 = sprintf("%04d", (int) ($id / 1000000)); | |
$dir2 = sprintf("%03d", (int) (($id % 1000000) / 1000)); | |
$dir3 = sprintf("%03d", (int) ($id % 1000)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using rvm with ruby-1.9.2-p290 | |
# latest version 2.7.8 | |
brew install libxml2 | |
# installing libxslt from source code | |
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz | |
tar xvfz libxslt-1.1.26.tar.gz | |
cd libxslt-1.1.26 | |
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example: | |
# | |
# class Page < ActiveRecord::Base | |
# include Positioned | |
# end | |
module Positioned | |
def self.included model_class | |
model_class.class_eval do | |
before_save :set_position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Русский перевод для https://github.com/plataformatec/devise/tree/v3.2.4 | |
# Другие переводы на http://github.com/plataformatec/devise/wiki/I18n | |
ru: | |
devise: | |
confirmations: | |
confirmed: "Ваша учётная запись подтверждена." | |
send_instructions: "В течение нескольких минут Вы получите письмо с инструкциями по подтверждению Вашей учётной записи." | |
send_paranoid_instructions: "Если Ваш адрес email есть в нашей базе данных, то в течение нескольких минут Вы получите письмо с инструкциями по подтверждению вашей учётной записи." | |
failure: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'net/http' | |
require 'openssl' | |
class UrlResolver | |
def self.resolve(uri_str, agent = 'curl/7.43.0', max_attempts = 10, timeout = 10) | |
attempts = 0 | |
cookie = nil | |
until attempts >= max_attempts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/lib/mysql2/mysql2.so: [BUG] Segmentation fault at 0x00000812970f4f | |
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-freebsd10.2] | |
-- Control frame information ----------------------------------------------- | |
c:0048 p:-4319933836 s:0206 e:000205 TOP [FINISH] | |
c:0047 p:---- s:0204 e:000203 CFUNC :require | |
c:0046 p:0132 s:0200 e:000199 METHOD /opt/chef/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 | |
c:0045 p:0282 s:0189 e:000188 TOP /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/lib/mysql2.rb:31 [FINISH] | |
c:0044 p:---- s:0186 e:000185 CFUNC :require | |
c:0043 p:0103 s:0182 e:000181 RESCUE /opt/chef/embedded/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133 |