Skip to content

Instantly share code, notes, and snippets.

View dgmstuart's full-sized avatar

Duncan Stuart dgmstuart

View GitHub Profile
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by yaml configure 0.1.4, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ ./configure --prefix=/Users/duncanstuart/.rvm/usr CC=/usr/bin/gcc-4.2 --no-create --no-recursion
## --------- ##
## Platform. ##
require 'minitest/autorun'
begin
require_relative 'bob'
rescue LoadError => e
eval("\"#{DATA.read}\n\"").split("\n.\n").each_with_index do |s,i|
if i > 0
puts "\t--- press enter to continue ---"
gets
end
@dgmstuart
dgmstuart / dxw-security.php
Last active August 29, 2015 14:10
A class for detecting when the plugin has updated (WordPress)
<?php
// ...
register_activation_hook( __FILE__, array( "dxw_security_Update_Checker", 'record_version' ));
if (dxw_security_Update_Checker::updated() ) {
dxw_security_Cron::schedule_tasks();
dxw_security_Update_Checker::record_version();
}
@dgmstuart
dgmstuart / Sandboxes.md
Last active August 29, 2015 14:16
Resources for teaching kids to code
@dgmstuart
dgmstuart / gist:33eeb05638bfebdc04db
Last active August 29, 2015 14:17
Javascript errors on Ryanair payment
First error: https://www.bookryanair.com/SkySales/Booking.aspx?culture=en-GB&lc=en-GB#Payment
GET https://www.bookryanair.com/cb/qv49l7bp/3515927592/check.js?_=1426706153419 jquery.min.js:6
x.ajaxTransport.send jquery.min.js:6
x.extend.ajax jquery.min.js:6
x.extend._evalUrl jquery.min.js:6
x.fn.extend.domManip jquery.min.js:5
x.fn.extend.append jquery.min.js:5
(anonymous function) jquery.min.js:5
x.extend.access jquery.min.js:4
@dgmstuart
dgmstuart / composer.lock
Created June 18, 2015 14:05
dunit + phpunit lockfile
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "37d741385deb98641a888b011966b466",
"packages": [],
"packages-dev": [
{
@dgmstuart
dgmstuart / test_case.rb
Created June 23, 2015 01:31
Rails presenter - failing test case
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.2'

Dependency Injection in Ruby 07 Oct 04

Introduction

At the 2004 Ruby Conference, Jamis Buck had the unenviable task to explain Dependency Injection to a bunch of Ruby developers. First of all, Dependency Injection (DI) and Inversion of Control (IoC) is hard to explain, the benefits are subtle and the dynamic nature of Ruby make those benefits even more marginal. Furthermore examples using DI/IoC are either too simple (and don’t convey the usefulness) or too complex (and difficult to explain in the space of an article or presentation). I once attempted to explain DI/IoC to a room of Java programmers (see onestepback.org/articles/dependencyinjection/), so I can’t pass up trying to explain it to Ruby developers.

Thanks goes to Jamis Buck (the author of the Copland DI/IoC framework) who took the time to review this article and provide feedback.

What is Dependency Injection?

@dgmstuart
dgmstuart / 1.9.3-p551
Created November 27, 2015 21:02
foundation-rails helper gemfile
PATH
remote: .
specs:
foundation_rails_helper (1.0.0)
actionpack (~> 4.1)
activemodel (~> 4.1)
activesupport (~> 4.1)
railties (~> 4.1)
tzinfo (~> 1.2, >= 1.2.2)
@dgmstuart
dgmstuart / talks.md
Last active February 14, 2016 21:08
Conference talks