Skip to content

Instantly share code, notes, and snippets.

View tmaslen's full-sized avatar

Tom Maslen tmaslen

View GitHub Profile
@tmaslen
tmaslen / serverless-creation-iam-policy.json
Last active March 16, 2017 17:02
example IAM policy for creating serverless services from the CLI
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"iam:CreateRole",
"iam:CreatePolicy",
"iam:AttachRolePolicy",
"iam:PassRole",
"lambda:GetFunction",
var _ = require( 'lodash' );
module.exports = function ( html ) {
var anyInlineCssTag = new RegExp( '<style type="text/css">[^<]*</style>', 'g' );
var matches = html.match( anyInlineCssTag );
_.uniq( matches ).forEach( function( styleTag ) {
#!/bin/bash
# Create a temp file that runs install instructions on the host
cat > finish-code-deploy.sh <<- EOM
rm -fr tweetgest.com
mkdir tweetgest.com
unzip code-to-deploy.zip -d tweetgest.com
EOM
# Zip up and deploy the code and the install script

# BBC News JavaScript Standard v0.0

Contents:

  • Introduction
  • Ensuring availability of JavaScript content for all users
  • JavaScript coding strategies
  • Legal requirements
  • Implementation and optimisation
  • XML HTTP Requests (AJAX)
#!/bin/bash
VM=default
DOCKER_MACHINE=/usr/local/bin/docker-machine
VBOXMANAGE=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m'
function init () {
async.series([
function( callback ) {
firstFunction( callback );
},
function( callback ) {
secondFunction( callback );
}
]);

My nan used to always cheat at Scrabble. I know this because she always used to help me win. She stopped cheating to help me about 10 years ago when I won without her help. I murdered the competition during that game, beating my sister, my mum and my nan by at least 100 points. From that day on nan always cheated to help the people I was playing against.

My nan always used to comment on my appearance. One year when I was growing my hair long each time I saw her she would tell me I looked scruffy. That I should get my hair cut short just like my granddad's. But when I did eventually get my hair cut she took one look at it and said "What you get your haircut for? I liked it the way it was".

My nan always used to tell me what to eat. She treated my being a vegetarian with great suspicion. Every week when I would take her shopping she'd try to tempt me with varying different kinds of meats from ASDA's deli section. And when she would cook for me on a Friday lunchtime she'd always offer to put an extr

<?php
class BBC_Indepthtoolkit_Model_Clickableguide
{
public $mainImage = null;
public $hotspots = array();
public $hotspotType = ""; // possible values: thumbnail|shape|label
public $panels = array();
public $layoutType = ""; // possible values: storybody-halfwide-include|SOMETHING ELSE - STEVE TO CONFIRM
public $panelType = ""; // possible values: dyn_full|dyn_half_wide|dyn_full_narrow|dyn_half_narrow|dyn_narrow
@tmaslen
tmaslen / gist:7785915
Created December 4, 2013 11:11
semantic argument around content vs presentational semantics for HTML/CSS
HTML + CSS are not mutually exclusive
Semantic HTML is one of the foundations of modern, professional web development. Semantic HTML is important to us because it increases the machine readability of a website, this is vital for SEO indexing and accessibility (screen readers). But machines read element names and property values, you make HTML more semantic by applying the correct element and by using id and href properties.
Search engine bots and screen readers take no semantic value from classes. Classes are semantic in the fact that they describe to us what they are for, but the primary purpose of them is to serve as hooks for developers to hang JS and CSS onto. Classes are semantically useful for describing how they will be presented, not what the content is about.
The most important thing for class name semantics in non-trivial (i.e. complex) applications is that they be driven by pragmatism and best serve their primary purpose - providing meaningful, flexible and reusable presentational/behavioura
import BBC.AWS.CloudFormation
from BBC.AWS.CloudFormation import SQS, IAM
from BBC.AWS.CloudFormation.Common.ResourcePermissions import SQSActions
try: import json
except ImportError: import simplejson as json
template = BBC.AWS.CloudFormation.Template()
template.description = (