Skip to content

Instantly share code, notes, and snippets.

Richard Peck richpeck

Block or report user

Report or block richpeck

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 000-default.conf
# /etc/apache2/sites-available/000-default.conf
##########################################
##########################################
## ##
## General Server Setup ##
## ##
##########################################
##########################################
View fix-wordpress-permissions.sh
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@richpeck
richpeck / post-receive
Created Aug 23, 2017
Post Receive Hook
View post-receive
#!/usr/bin/env ruby
# REF => https://gist.github.com/karmi/442106#file-post-receive-deploy-rb-L21
###################################################
# === CONFIGURE THE SCRIPT HERE ================= #
deploy_branch = 'master' #=> change to production
git_path = Dir.pwd
application_path = File.dirname(git_path) + "/current"
@richpeck
richpeck / default
Last active Sep 10, 2017
NGinx Setup
View default
# /etc/nginx/sites-enabled/default
##########################################
##########################################
## General Server Setup ##
##########################################
##########################################
@richpeck
richpeck / config.coffee
Created Jun 26, 2017
CKEditor Upload Options Coffeescript
View config.coffee
#################################################
#################################################
## _____ _ __ _____ _ _ _ ##
## / __ \| | / /| ___| | (_) | ##
## | / \/| |/ / | |__ __| |_| |_ ___ _ __ ##
## | | | \ | __|/ _` | | __/ _ \| '__| ##
## | \__/\| |\ \| |__| (_| | | || (_) | | ##
## \____/\_| \_/\____/\__,_|_|\__\___/|_| ##
## ##
#################################################
@richpeck
richpeck / default
Last active Jun 7, 2017
NGinx SSL Setup
View default
# /etc/nginx/sites-enabled/default
##########################################
##########################################
## General Server Setup ##
##########################################
##########################################
@richpeck
richpeck / config
Last active Jan 19, 2017
ROUTES Exception Handling In Rails
View config
# => Exceptions App
# => Sends to routes (notice how it does not persist the request)
# => config/application.rb
config.exceptions_app = self.routes
# => Routes
# => Sends to the appropriate view
# => config/rtoutes.rb
%w( 404 422 500 ).each do |code|
get code, controller: :application, action: :show, code: code
@richpeck
richpeck / application.rb
Last active Aug 4, 2018
CONTROLLER Exception Handling In Rails
View application.rb
# config/application.rb
# This can be put in any of the "environment" files - config/application.rb is just the main
config.exceptions_app = ->(env) { ApplicationController.action(:exception).call(env) }
# If you want custom exceptions, you need to add new rescue_responses:
# http://guides.rubyonrails.org/configuring.html#configuring-action-dispatch
config.action_dispatch.rescue_response["Your::Exception"] = :bad_request
@richpeck
richpeck / content.rb
Created Nov 15, 2015 — forked from bastien/content.rb
Paperclip processor to convert PDF to JPG to go around problems with the old versions of imagemagick and ghostscript available on Heroku. This file is located in [APP_ROOT]/lib/paperclip_processors/ghostscript.rb
View content.rb
# Model using the ghostscript processor
class Content < ActiveRecord::Base
has_attached_file :resource,
:styles => { :preview => ["725x1200>", :jpg], :thumb => ["100x140>", :jpg] },
:processors => [:ghostscript, :thumbnail],
:convert_options => { :all => '-colorspace RGB -flatten -density 300 -quality 100' },
:path => ":page_path/:class/:id/:resource_token/:style/:filename"
end
@richpeck
richpeck / _livesearch.html.erb
Last active Nov 11, 2015
LiveSearch (Firststop)
View _livesearch.html.erb
<div class="livesearch_container">
<table class="livesearch_results">
<% unless search.blank? %>
<% search.each_with_index do |item,i| %>
<% pos ||= '' %>
<% if (i == 0) then pos = 'first' end %>
<% if (i == search.size - 1) then pos += ' last' end %>
You can’t perform that action at this time.