This gist is deprecated in favor of https://github.com/ninenines/cowboy/blob/master/doc/src/guide/specs.asciidoc which has a formatted version at https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/
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
if Rails.env.development? | |
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:include, QueryTracer::MysqlAdapterExtensions) | |
Object.send(:include, QueryTracer::ObjectExtensions) | |
end |
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 'haml' | |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) | |
push_text "<%= #{text.strip} %>" | |
end | |
def push_silent(text, can_suppress = false) | |
push_text "<% #{text.strip} %>" |
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
group :development, :test do | |
gem 'rspec-rails', '~> 2.9' # rails generate rspec:install | |
gem 'factory_girl_rails' | |
end | |
group :test do | |
gem 'spork-rails' # spork rspec --bootstrap | |
gem 'capybara' | |
gem 'launchy' | |
gem 'timecop' |
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
define ruby_stack_trace | |
set $VM_FRAME_MAGIC_METHOD = 0x11 | |
set $VM_FRAME_MAGIC_BLOCK = 0x21 | |
set $VM_FRAME_MAGIC_CLASS = 0x31 | |
set $VM_FRAME_MAGIC_TOP = 0x41 | |
set $VM_FRAME_MAGIC_FINISH = 0x51 | |
set $VM_FRAME_MAGIC_CFUNC = 0x61 | |
set $VM_FRAME_MAGIC_PROC = 0x71 | |
set $VM_FRAME_MAGIC_IFUNC = 0x81 | |
set $VM_FRAME_MAGIC_EVAL = 0x91 |
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
#!/bin/bash | |
## Short introduction ## | |
# It is supposed that you have MySQL and lot of files to backup. Done via mk-parallel-dump (maatkit). | |
# Files (as well as DB dumps) are keept versioned, so you can revert to any state during last 20 days. Done via rdiff-backup. | |
# Afterwards, files (with versioning metainfo) are transfered to FTP server. Done via duplicity. | |
# Required software: | |
# 1. maatkit (mk-parallel-dump) | |
# 2. rdiff-backup |
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
# interpreted AST | |
system ~/projects/jruby $ jruby.bash -X-C mandelbrot.rb 20 | |
warming up | |
running mandelbrot(500) for 20 iterations | |
4.862 | |
4.822 | |
4.822 | |
4.846 | |
5.057 |
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
class ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection } | |
end | |
end | |
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
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
Ruby 2.1.0 in Production: known bugs and patches | |
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production. | |
While testing the new build for rollout, we ran into a number of bugs. Most of | |
these have been fixed on trunk already, but I've documented them below to help | |
anyone else who might be testing ruby 2.1 in production. | |
@naruse I think we should backport these patches to the ruby_2_1 branch and | |
release 2.1.1 sooner rather than later, as some of the bugs are quite critical. | |
I'm happy to offer any assistance I can to expedite this process. |
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
After spending the better part of the month implementing date support | |
in RethinkDB, Mike Lucy sent the team the following e-mail. It would | |
have been funny, if it didn't cause thousands of programmers so much | |
pain. Read it, laugh, and weep! | |
----- | |
So, it turns out that we're only going to support dates between the | |
year 1400 and the year 10000 (inclusive), because that's what boost | |
supports. |
OlderNewer