Skip to content

Instantly share code, notes, and snippets.

View johnbeynon's full-sized avatar

John Beynon johnbeynon

View GitHub Profile
@johnbeynon
johnbeynon / gist:9322859
Created March 3, 2014 11:06
before_deploy.sh
#!/usr/bin/env bash
set -e
echo "Running post Heroku deployment script"
echo "Installing Heroku toolbelt"
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
# You need to bundle if you want to be able to enabled maintenance mode.
# bundle
@johnbeynon
johnbeynon / gist:9322825
Created March 3, 2014 11:04
Travis YML
language: ruby
rvm:
- 2.0.0
cache: bundler
before_install:
- "psql -c 'create database <dbname>;' -U postgres"
- "psql -U postgres -q -d <dbname> -f db/structure.sql"
- "cp config/database.yml.travis config/database.yml"
env:
matrix:
[2014-01-30T09:53:02+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-01-30T09:53:02+00:00] ERROR: service[postgresql] (postgresql::server_debian line 30) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/postgresql restart ----
STDOUT: * Restarting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2014-01-30 09:53:02 GMT FATAL: could not load server certificate file "server.crt": No such file or directory
...fail!
STDERR:
---- End output of /etc/init.d/postgresql restart ----
Ran /etc/init.d/postgresql restart returned 1
@johnbeynon
johnbeynon / gist:8306497
Created January 7, 2014 20:41
first pass at duplicating Philips Wake up light functionality
# Fade up Light from 0 to 80% over 30 minutes
time_to_take = 1800 # in seconds
increase_to_level = 80 # percent
number_of_steps = increase_to_level / 10
time_per_step = time_to_take / number_of_steps
0.upto(number_of_steps) do |loop_index|
level = loop_index * 10
puts "Increasing Light Level to #{level}%"
@johnbeynon
johnbeynon / gist:6915478
Last active December 25, 2015 04:09
Devise strategy to bypass entering a password for development mode

This is a simple devise strategy that allows you to bypass the need to enter a password when a site is runnning in development mode.

lib\devise\strategies\development.rb

module Devise
  module Strategies
    class Development < Authenticatable
      def authenticate!
 resource = mapping.to.find_for_database_authentication(authentication_hash)
@johnbeynon
johnbeynon / gist:6460735
Created September 6, 2013 07:44
Heroku generated database.yml
<%
require 'cgi'
require 'uri'
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
-----> DEPRECATIONS:
Runtime asset compilation is being removed on Sep. 18, 2013.
Builds will soon fail if assets fail to compile.
@johnbeynon
johnbeynon / gist:5465651
Last active December 16, 2015 16:49
Chambers

Chambers Skip Hire Guildford

Dear Sir/Madam,

I should like report inappropriate behaviour from the driver of one of your blue skip collection vehicles (empty at the time) that had turned right onto Grange Road off Stoughton Road in Guildford this morning at approximately 7:23am.

Your vehicle had stopped behind the parked vehicles that adorn Grange Road on their side of the road, I was travelling at speed on my bike in the opposite direction when your vehicle decided to pull out into my path and as we approached was using far more of the road that was needed and forced me to mount the pavement. As we passed I was subjected to verbal abuse of which I only caught 'I pay bloody tax' being shouted at me.

I should be grateful if you could pass onto your drivers;

kyan/sage/sop[kyan_addons]% fudge build
Running build default
Running task yard {:arguments=>"-r YardREADME.md", :coverage=>100}
[warn]: @param tag has unknown parameter name: Optional
in file `sop_ui/lib/sop_ui/document.rb' near line 34
[warn]: Unknown tag @params in file `sop_ui_components/lib/sop_ui_components/widgets/menu.rb` near line 30
[warn]: Unknown tag @rescue in file `sop_support/lib/sop_support/event_tracking/event_tracker.rb` near line 12
[warn]: @param tag has unknown parameter name: options
in file `sop_support/lib/sop_support/event_tracking/event_tracker.rb' near line 12
[warn]: in YARD::Handlers::Ruby::MixinHandler: Undocumentable mixin: YARD::Parser::UndocumentableError for class SopAuthentication::AuthProviders::Sageid
@johnbeynon
johnbeynon / gist:4284757
Created December 14, 2012 11:25
My Heroku wishlist....
1. Safe Harbour
Why? To be able to host my apps with Heroku and meet current EU rulings on data storage
2. MultiRegion
Why? US-East Amazon. Enough said. Most apps we build are for EU customers so to be able to have the application closer to the end user is always a good thing.
3. Clearer way to identify owned versus collaborated apps in the dashboard