Skip to content

Instantly share code, notes, and snippets.

View Epigene's full-sized avatar

Augusts Bautra Epigene

View GitHub Profile
@Epigene
Epigene / staging.rb
Created March 22, 2016 10:33
Dokku v0.4.x app staging environment file
Rails.application.configure do
config.action_controller.asset_host = "https://staging.yourdomain.com/"
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = true
config.serve_static_files = false
config.assets.js_compressor = :uglifier
@Epigene
Epigene / truncated_request_dump.txt
Created March 21, 2016 07:55
Request dump where browser's browser.to_s fails with undefined method `[]' for nil:NilClass
:mobile_device? encountered an error:
undefined method `[]' for nil:NilClass
Request:
#<ActionDispatch::Request:0xf2ba0c0 @env={"REMOTE_ADDR"=>"127.0.0.1", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/lv/lv/p/m1/intro", "PATH_INFO"=>"/lv/lv/p/m1/intro", "REQUEST_URI"=>"/lv/lv/p/m1/intro", "SERVER_PROTOCOL"=>"HTTP/1.0", "HTTP_VERSION"=>"HTTP/1.0", "HTTP_X_REAL_IP"=>"104.155.83.235", "HTTP_X_FORWARDED_FOR"=>"104.155.83.235", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_HOST"=>"v1.stockholmhealth.com", "HTTP_CONNECTION"=>"close", "rack.url_scheme"=>"https", "SERVER_NAME"=>"v1.stockholmhealth.com", "SERVER_PORT"=>"443", "QUERY_STRING"=>"", "rack.input"=>#<StringIO:0x9678ca8>, "rack.hijack"=>#<Proc:0xf270538@/home/deployer/apps/nordenhealth/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_request.rb:111>, "rack.errors"=>#<File:/home/deployer/apps/nordenhealth/current/log/unicorn.log>, "rack.multiprocess"=>true, "rack.multithread"=>false, "rack.run_once"=>false, "rack.version"=>[1, 2], "SCRIPT_NAME"=>"", "SER
@Epigene
Epigene / inadequate_request_dump.txt
Created March 21, 2016 07:51
Dump of a request object where browser gem's `browser.to_s` fails with undefined method `[]' for nil:NilClass
This file has been truncated, but you can view the full file.
:mobile_device? encountered an error:
undefined method `[]' for nil:NilClass
Request:
#<ActionDispatch::Request:0xf2ba0c0 @env={"REMOTE_ADDR"=>"127.0.0.1", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/lv/lv/p/m1/intro", "PATH_INFO"=>"/lv/lv/p/m1/intro", "REQUEST_URI"=>"/lv/lv/p/m1/intro", "SERVER_PROTOCOL"=>"HTTP/1.0", "HTTP_VERSION"=>"HTTP/1.0", "HTTP_X_REAL_IP"=>"104.155.83.235", "HTTP_X_FORWARDED_FOR"=>"104.155.83.235", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_HOST"=>"v1.stockholmhealth.com", "HTTP_CONNECTION"=>"close", "rack.url_scheme"=>"https", "SERVER_NAME"=>"v1.stockholmhealth.com", "SERVER_PORT"=>"443", "QUERY_STRING"=>"", "rack.input"=>#<StringIO:0x9678ca8>, "rack.hijack"=>#<Proc:0xf270538@/home/deployer/apps/nordenhealth/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_request.rb:111>, "rack.errors"=>#<File:/home/deployer/apps/nordenhealth/current/log/unicorn.log>, "rack.multiprocess"=>true, "rack.multithread"=>false, "rack.run_once"=>false, "rack.version"=>[1, 2], "SCRIPT_NAME"=>"", "SER
@Epigene
Epigene / known_nord_master_failures.txt
Created March 16, 2016 12:07
Test failures on master, before rails update an Transaction -> Payment change
Finished in -23759279.72749 seconds (files took 5.46 seconds to load)
590 examples, 65 failures, 39 pending
Failed examples:
rspec ./spec/models/order_spec.rb:26 # Order Spec should get a user with phone number by default
rspec ./spec/models/order_spec.rb:341 # Order current_pipeline_payment_system order without pipline returns nil
rspec ./spec/models/order_spec.rb:356 # Order paid order has one paid order
rspec ./spec/models/order_spec.rb:195 # Order statuses #paid? should return true if status is paid
rspec ./spec/models/order_spec.rb:218 # Order statuses ecommercable? method should return true if order paid but transaction provider is swedbank_lv
@Epigene
Epigene / fish.conf
Created February 10, 2016 13:48
Fish2 configuration file
# Path to Oh My Fish install.
set -gx OMF_PATH /Users/augusts/.local/share/omf
source $OMF_PATH/init.fish
# Path to your oh-my-fish.
set PATH /Applications/Postgres.app/Contents/Versions/9.4/bin $PATH
set PATH ~/bin $PATH
set PATH /usr/local/bin $PATH
set -x RACK_ENV development
set -x EDITOR atom
@Epigene
Epigene / production.rb
Last active December 21, 2018 01:38
Dokku v0.4.x app production environment file
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_files = false
config.assets.js_compressor = :uglifier
config.assets.compile = false
@Epigene
Epigene / Fallout4_Mod.md
Last active December 11, 2015 21:13
Fallout4 modding startup

Enable Custom content

1. Enable file selection

#../MyGames/Fallout4/Fallout4Prefs.ini

# under [Launcher]
bEnableFileSelection=1
@Epigene
Epigene / multiline_ternary.rb
Created October 2, 2015 06:46
A glorious antipattern
# simple
def test(arg)
arg ?
"true" :
"false"
end
# nested
def test2(arg1, arg2)
arg1 ?
@Epigene
Epigene / routes_guidelines.rb
Last active January 19, 2016 10:16
Creative routes guidelines
# required libraries always in first lines
require 'resque/server'
Rails.application.routes.draw do
# 1. External engines and services are mounted first
mount RailsAdmin::Engine => '/super_admin', as: 'rails_admin'
# 2. Always use "smart" redirects, conserving original parameters via http://stackoverflow.com/questions/16943169/rails-routes-how-to-pass-all-request-params-in-a-redirect
get '', to: redirect{ |_, request| ["/#{I18n.locale}", request.params.to_query].reject(&:blank?).join("?") }