Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Peck richpeck

View GitHub Profile
@richpeck
richpeck / page.google-product-feed.liquid
Last active Nov 19, 2020 — forked from cameroncowden/page.google-product-feed.liquid
Shopify Google Product Feed xml generator
View page.google-product-feed.liquid
{%- 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
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
You can’t perform that action at this time.