Skip to content

Instantly share code, notes, and snippets.

View chatman-media's full-sized avatar
馃幆
Focusing

Alexander Kireyev chatman-media

馃幆
Focusing
View GitHub Profile
@chatman-media
chatman-media / gist:8038439
Last active December 31, 2015 20:09
Rails servers
~ ab -c %number% -n 2000 http://0.0.0.0:3000/api/v1/search.json
Unicorn
Concurrency Level: 50
Time taken for tests: 9.256 seconds
Complete requests: 2000
Failed requests: 0
@chatman-media
chatman-media / gist:7724920
Created November 30, 2013 21:46
angular-seed html5mode fix
Okay, this is what I ended up with in the connect.options task config. Seems to work.
connect: {
options: {
// ...
// Modrewrite rule, connect.static(path) for each path in target's base
middleware: function (connect, options) {
var optBase = (typeof options.base === 'string') ? [options.base] : options.base;
return [require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
optBase.map(function(path){ return connect.static(path); }));
@chatman-media
chatman-media / Gemfile
Created November 30, 2013 08:45 — forked from pcreux/Gemfile
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
@chatman-media
chatman-media / gist:7392023
Created November 10, 2013 00:27
Mongoid index expectation issue
before(:all) do
Model.create_indexes
end
let(:indexes){ Model.collection.indexes }
it { expect(indexes[created_at: 1]).to_not be_nil }
module Taggable
extend ActiveSupport::Concern
included do
attr_accessible :tags
after_save :set_tags
after_destroy :unset_tags
end
gem 'coderay', require: false
gem 'slop', require: false
gem 'method_source', require: false
gem 'pry', require: false
gem 'yard', require: false
gem 'pry-doc', require: false
gem 'columnize', require: false
gem 'debugger-ruby_core_source', require: false
gem 'debugger-linecache', require: false
gem 'debugger', require: false
SourceFileInfo.find_or_create_by(hash: hash) do |sfi|
sfi.name = file_id
sfi.ext = ext
sfi.path = file_path
sfi.original_name = original_name
sfi.user = user
end

Useful Gems for Rails development

Each gem include short description.


gem 'railroady'

Model and controller UML class diagram generator. ActiveRecord only.

@chatman-media
chatman-media / ruby_tips.rb
Created October 24, 2013 14:47
ruby tips
piglatinified = strs.map { |str| piglatinify(str) }
# ->
piglatinified = strs.map(&method(:piglatinify))
upcase_lambda = lambda { |str| str.upcase }
# ->
upcase_lambda = -> s { s.upcase }
upcase_lambda.call('foo')