Skip to content

Instantly share code, notes, and snippets.

Paul prwhitehead

Block or report user

Report or block prwhitehead

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3345ac0de889b8556591f29c182594b4
" Key bindings / mappings
"==========================================================="
" Set leader key
:let mapleader = ","
" Comment out a line
map cl 0i#<Esc>
" Use <Tab> to switch tabs, not ctrl+w
View gist:2b5ac6764c9e1d3c3adcbdf7a5bc5606
task enquiries: :environment do
log = Rails.root.join("log", "#{Rails.env}.log")
f = File.open(log, "r")
mails = []
begin
while (txt = f.readline)
mails.push(read_mail(f)) if txt.include?("MailForm::Notifier#contact")
end
View gist:9966ec21154989e687b526daac8e43fe
# GEMFILE
source 'https://rubygems.org'
gem 'rails', '~> 5.1.6'
gem 'railties', '~> 5.1'
gem 'mysql2'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
View gist:18ce614536f30e2185bfb698ee5fe581
# As per: https://www.devmynd.com/blog/rails-local-development-https-using-self-signed-ssl-certificate/
$ openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt
$ rails s -b 'ssl://localhost:3000?key=path/to/file/localhost.key&cert=path/to/file/localhost.crt'
@prwhitehead
prwhitehead / nginx-tls.conf
Created Mar 14, 2018 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
View nginx-tls.conf
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gav.sh
#
View gist:dc62e70ac98e010422190e9c976e9fb4
Add a file to `/etc/logrotate.d/YOUR_PROJECT_NAME`
/opt/YOUR_PROJECT_NAME/shared/log/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
View clear-sidekiq-jobs.sh
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
View gist:7ba9589703a4acd4067271a9e497704c
old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
#To turn it back on:
ActiveRecord::Base.logger = old_logger
View gist:0854dbeb48ea9154a9406daf342bb558
array.inject(Hash.new(0)) { |h,e| h[e] += 1; h }
You can’t perform that action at this time.