Skip to content

Instantly share code, notes, and snippets.

@docunext
docunext / Gemfile
Last active December 15, 2015 08:59
Trying to make debian and rails4 play nicely.
source 'https://rubygems.org'
# Do not change - using system gems install by apt
group :debian do
gem 'pg', '0.13.2'
gem 'tilt', '1.3.3'
gem 'rdoc', '3.9.4'
gem 'erubis', '2.7.0'
gem 'tzinfo', '0.3.33'
# Thanks http://devblog.mixlr.com/2012/09/01/nginx-lua/
class CsrfTokenEndpoint
def self.call(env)
if env["PATH_INFO"] =~ /^\/csrf_token_endpoint/
session = env["rack.session"] || {}
token = session[:_csrf_token]
if token.nil?
token = SecureRandom.base64(32)
session[:_csrf_token] = token
set :stage, 'production'
set :shared_children, shared_children << 'tmp/sockets'
puma_sock = "unix://#{shared_path}/sockets/puma.sock"
puma_control = "unix://#{shared_path}/sockets/pumactl.sock"
puma_state = "#{shared_path}/sockets/puma.state"
puma_log = "#{shared_path}/log/puma-#{stage}.log"
namespace :deploy do
desc "Start the application"
require 'active_support/concern'
module MiniController
extend ActiveSupport::Concern
included do
include AbstractController::Layouts
include ActionController::Helpers
include ActionController::UrlFor
@docunext
docunext / RAILS_ENV2Rails.env
Last active December 16, 2015 10:39
Change RAILS_ENV to Rails.env
for i in app config lib test; do grep -rl RAILS_ENV $i | awk '{print "sed -ri \"s/RAILS_ENV/Rails.env/g\" " $1 }' > com.sh && sh com.sh && rm com.sh; done
for i in app config lib test; do grep -rl RAILS_ROOT $i | awk '{print "sed -ri \"s/RAILS_ROOT/Rails.root/g\" " $1 }' > com.sh && sh com.sh && rm com.sh; done
for i in app config lib test; do grep -rlE " $" $i | awk '{print "sed -ri \"s/\ +$//g\" " $1 }' > com.sh && sh com.sh && rm com.sh; done
@docunext
docunext / contributions.txt
Created December 16, 2016 01:30
Contributions
https://git.kernel.org/cgit/git/git.git/commit/?id=246090a5d0ff3a51df8fed676e8159c3776c954a
https://git.kernel.org/cgit/git/git.git/commit/?id=897e3e454062d2bb9d3c1e4068caf4971fd713ff
https://git.kernel.org/cgit/git/git.git/commit/?id=a2f69581ffc26fadb27bc29dd03074791a16d61e
https://git.kernel.org/cgit/git/git.git/commit/?id=13f72a1d5faacfdfea43e2fd961cb4009206a605
http://contributors.rubyonrails.org/contributors/albert-lash/commits
https://blog.codeship.com/producing-documentation-for-your-rails-api/