Skip to content

Instantly share code, notes, and snippets.

View edtjones's full-sized avatar

Ed Jones edtjones

  • Canva
  • UK
View GitHub Profile
___ _ __ _ __ ___ _ __
/ _ \ '__| '__/ _ \| '__|
| __/ | | | | (_) | |
\___|_| |_| \___/|_|
You're logging into error-shared1.hosts.errorstudio.com.
Please don't screw anything up.
<%= link_to (toc_item[:title].encoding == 'UTF-8') ? toc_item[:title] : "#{toc_item[:title].encoding} WAAAH", document_page_path(@document,toc_item[:id]) %>
@edtjones
edtjones / unicorn
Created September 10, 2013 11:53 — forked from shapeshed/unicorn
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production
$.rails.allowAction = function(link) {
if (!link.attr('data-confirm')) {
return true;
}
$.rails.showConfirmDialog(link);
return false;
};
$.rails.confirmed = function(link) {
link.removeAttr('data-confirm');
@edtjones
edtjones / thumbs.sh
Last active August 29, 2015 14:07
Add thumbnails (named the same as the movie) for Mov, MP4 and M4V files
#!/bin/bash
while getopts ":t:" opt; do
case $opt in
t)
time=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1

Keybase proof

I hereby claim:

  • I am edtjones on github.
  • I am edjones (https://keybase.io/edjones) on keybase.
  • I have a public key whose fingerprint is EB21 5CCC ECA9 503F B00A 2EA3 D6BB 584E A9D4 8B19

To claim this, I am signing this object:

@edtjones
edtjones / contentful_model_example.rb
Last active August 29, 2015 14:15
contentful_model - setup and example model
require 'contentful'
require 'contentful_model'
#Configure your access to Contentful: demo account shown here
ContentfulModel.configure do |config|
config.access_token = "b4c0n73n7fu1" #replace with your access token
config.space = "cfexampleapi" #replace with your space ID
config.options = {
#extra options to send to the Contentful::Client
}
@edtjones
edtjones / contentful_webhooks_routes.rb
Created February 9, 2015 11:37
ContentfulRails webhooks route example
# Mount the ContentfulRails Engine at /contentful
# Feel free to choose a different endpoint name
mount ContentfulRails::Engine => '/contentful'
@edtjones
edtjones / rake_routes.sh
Last active August 29, 2015 14:15
ContentfulRails - check Engine routes
# On the command line you can see the new routes:
bundle exec rake routes
#Which returns:
# contentful_rails /contentful ContentfulRails::Engine
# Routes for ContentfulRails::Engine:
# debug_webhooks GET /webhooks/debug(.:format) contentful_rails/webhooks#debug {:format=>:json}webhooks POST /webhooks(.:format)
# contentful_rails/webhooks#create {:format=>:json}
@edtjones
edtjones / application_controller.rb
Created February 9, 2015 12:07
ContentfulRails - add helpers to your ApplicationController
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
#Include the ContentfulRails Markdown helper.
helper ContentfulRails::MarkdownHelper
end