Skip to content

Instantly share code, notes, and snippets.

@philandstuff
philandstuff / devopsdays.org
Last active October 12, 2017 21:05
Devopsdays london 2017

Devopsdays London 2017

initial session, bob walker (@rjw1)

  • welcome everyone!
  • we have a code of conduct
  • thanks to organisers, sponsors, etc

Humane Teams at home and around the world

@Integralist
Integralist / Array Iterator Navigation.php
Last active July 7, 2023 03:38
Loop recursively through a multi-level array using the SPL (Standard PHP Library) RecursiveArrayIterator
<?php
$multilevelArray = array(
"a" => array(
"i" => "aa",
"ii" => "bb",
"url" => "http://www.integralist.co.uk/",
"iii" => "cc"
),
"b" => "c",
"url" => "http://www.github.com/"
@Integralist
Integralist / Ruby Splats.rb
Last active October 8, 2015 12:40
Ruby Splat (single and double)
# When calling a method with a splat then the parameters are passed as a comma separated list
# When receiving arguments with a splat then they are converted into an Array
# When using a double splat (2.0+) then the argument is converted into a Hash (i.e. named parameters)
def foo(*args)
p args
end
foo 'a', 'b', 'c'
# => ["a", "b", "c"]
@Integralist
Integralist / 1. Typical Example.rb
Last active January 29, 2016 08:51
Ruby: Symbol class to_proc and custom class object to_proc (see also https://gist.github.com/Integralist/8079e79c5eb4e7b88183 to see how to use `&` with `method()`)
strs = ['foo', 'bar', 'baz']
# standard long form way
caps = strs.map { |str| str.upcase }
# short hand
caps = strs.map(&:upcase)
# The & takes any object and calls to_proc on it
# In the above example we're using a Symbol and not an object
@Crystalh
Crystalh / gist:9414561
Last active August 29, 2015 13:57
TDD Practices

#TDD Practices

##Bad Practices Patterns that can be improved, or simply bad practices spotted within unit tests.

##PHP

###1) Repetition in all tests. Create a setUp() to handle this:

@garnaat
garnaat / iam_ec2_example.py
Created September 15, 2010 04:48
Use IAM/boto to provide access to EC2 and S3
"""
IAM boto examples:
In this example we create a group that provides access
to all EC2 and S3 resources and actions and then add a
user to that group.
"""
import boto
#
# First create a connection to the IAM service
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Drag and Drop</title>
<style type="text/css">
body {
margin:15px;
padding:0;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Hungry Kid!</title>
<style type="text/css">