Skip to content

Instantly share code, notes, and snippets.

View simmogs's full-sized avatar

Graeme Simpson simmogs

View GitHub Profile
@simmogs
simmogs / Gemfile.rb
Created April 4, 2011 13:15
My current Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'devise', '~>1.2', :git => 'https://github.com/plataformatec/devise.git', :branch => "v1.2"
gem "oa-oauth", :require => "omniauth/oauth"
@simmogs
simmogs / Gemfile
Created November 6, 2011 14:25
Gemfile to assist with problem diagnosis of capybara-screenshot
source 'http://rubygems.org'
gem "rails", "~> 3.1.1"
gem 'mysql2'
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.4"
@simmogs
simmogs / wicked_pdf.rb
Created November 23, 2011 15:13 — forked from anlek/wicked_pdf.rb
Using Wicked_PDF with Rails 3.1
#in config/initializers/wicked_pdf.rb
module WickedPdfHelper
def wicked_pdf_stylesheet_link_tag(*sources)
sources.collect { |source|
"<style type='text/css'>#{Rails.application.assets.find_asset("#{source}.css").body}</style>"
}.join("\n").gsub(/url\(['"](.+)['"]\)(.+)/,%[url("#{wicked_pdf_image_location("\\1")}")\\2]).html_safe
end
def wicked_pdf_image_tag(img, options={})
image_tag wicked_pdf_image_location(img), options
@simmogs
simmogs / backtrace
Created August 19, 2012 19:07
Backtrace for odd 'dir?' missing method
When I go to the admin orders page # features/step_definitions/web_steps.rb:51
undefined method `dir?' for #<Order:0x0000000a922048> (NoMethodError)
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:407:in `method_missing'
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:149:in `method_missing'
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/rush-0.6.8/lib/rush/commands.rb:22:in `block in search'
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/rush-0.6.8/lib/rush/commands.rb:21:in `each'
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/rush-0.6.8/lib/rush/commands.rb:21:in `search'
/home/graeme/.rvm/gems/ruby-1.9.3-p194@butterware/gems/activerecord-3.2.8/lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
/home/graeme/Code/lunch/app/con
@simmogs
simmogs / amended.eml
Created September 4, 2012 16:01
Error with mail replacing attachments
Received: from [192.168.1.200] (helo=blah) by accept with esmtp (Exim 4.72) (envelope-from <[email protected]>) id 1T4QaS-0000tn-F2 for [email protected]; Thu, 23 Aug 2012 07:08:12 +0100
Date: Thu, 30 Aug 2012 15:38:54 +0100
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: test3
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0041_01CD86C5.92F54800";
charset=UTF-8
@simmogs
simmogs / omxloop.py
Created September 23, 2013 10:12
OmxPlayer loop for Raspbian
#!/usr/bin/python
import sys
import subprocess
import os
import glob
path ='/home/pi/'
while(1):
for infile in glob.glob(os.path.join(path, '*.mp4')):
a = subprocess.call( [ "omxplayer", "-o", "hdmi", infile])
$ sudo apt-get install libmagickwand-dev
[sudo] password for graeme:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmagickwand-dev is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
$ PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick
version: '2'
services:
db:
image: postgres:9.6
ports:
- "5432"
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
@simmogs
simmogs / production
Created December 8, 2016 14:22
docker network inspect for staging and production
[
{
"Name": "bridge",
"Id": "b636058b73f7df986e1fee1fa052b1af465238b1f54bb330332653dc3142aa17",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,