Skip to content

Instantly share code, notes, and snippets.

View richpeck's full-sized avatar

Richard Peck richpeck

View GitHub Profile
@richpeck
richpeck / page.google-product-feed.liquid
Last active November 19, 2020 11:07 — forked from cameroncowden/page.google-product-feed.liquid
Shopify Google Product Feed xml generator
{%- comment -%}
Instructions:
- Create a blank page called 'Google Base Product Feed'and save it
- Open that page for editing and select 'page.google-feed' from the page template selector
- Add a brief site description to the meta-shop-description snippet
- The feed url should now be available at http://www.yoursite.com/pages/google-base-product-feed
- validate your field at http://validator.w3.org/feed/
- when ready, submit your feed at http://base.google.com
@richpeck
richpeck / 000-default.conf
Created August 4, 2019 10:00
Apache Default
# /etc/apache2/sites-available/000-default.conf
##########################################
##########################################
## ##
## General Server Setup ##
## ##
##########################################
##########################################
@richpeck
richpeck / fix-wordpress-permissions.sh
Created March 30, 2019 16:03 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/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 August 23, 2017 15:13
Post Receive Hook
#!/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 September 10, 2017 07:20
NGinx Setup
# /etc/nginx/sites-enabled/default
##########################################
##########################################
## General Server Setup ##
##########################################
##########################################
@richpeck
richpeck / config.coffee
Created June 26, 2017 18:56
CKEditor Upload Options Coffeescript
#################################################
#################################################
## _____ _ __ _____ _ _ _ ##
## / __ \| | / /| ___| | (_) | ##
## | / \/| |/ / | |__ __| |_| |_ ___ _ __ ##
## | | | \ | __|/ _` | | __/ _ \| '__| ##
## | \__/\| |\ \| |__| (_| | | || (_) | | ##
## \____/\_| \_/\____/\__,_|_|\__\___/|_| ##
## ##
#################################################
@richpeck
richpeck / default
Last active June 7, 2017 12:35
NGinx SSL Setup
# /etc/nginx/sites-enabled/default
##########################################
##########################################
## General Server Setup ##
##########################################
##########################################
@richpeck
richpeck / config
Last active January 19, 2017 22:40
ROUTES Exception Handling In Rails
# => 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 August 4, 2018 22:02
CONTROLLER Exception Handling In Rails
# 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 November 15, 2015 22:02 — 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
# 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