Skip to content

Instantly share code, notes, and snippets.

View richardpeng's full-sized avatar

Richard Boneff-Peng richardpeng

View GitHub Profile
@richardpeng
richardpeng / active_admin.rb
Last active December 13, 2018 20:05 — forked from francois-ferrandis/active_admin.rb
Customize the active admin layout
# config/initializers/active_admin.rb
# ...rest of the initializer here...
module AdminPageLayoutOverride
def build(*args)
# you can move the call to super at the end, if you wish
# to insert things at the begining of the page
super
@richardpeng
richardpeng / ssl_puma.sh
Created April 8, 2016 19:10 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@richardpeng
richardpeng / cli.ini
Last active December 28, 2015 05:15 — forked from thisismitch/le-renew-webroot
Let's Encrypt Auto-Renewal using the Webroot Plugin (Nginx)
# This is an example of the kind of things you can do in a configuration file.
# All flags used by the client can be configured here. Run Let's Encrypt with
# "--help" to learn more about the available options.
# Use a 4096 bit RSA key instead of 2048
rsa-key-size = 4096
# Always use the staging/testing server
# server = https://acme-staging.api.letsencrypt.org/directory
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def current_user
@current_user ||= session[:user_id] and User.find(session[:user_id]['$oid'])
end