Skip to content

Instantly share code, notes, and snippets.

View commuterjoy's full-sized avatar

Matt Chadburn commuterjoy

View GitHub Profile
@commuterjoy
commuterjoy / gist:1389530
Created November 23, 2011 18:51
Rake task to list the latest test RPMs that can be deployed to stage
desc "list the latest test RPMs that can be deployed to stage"
task :releasable do
packages = ['bbc-pal-tabloid', 'bbc-pal-library-berliner', 'bbc-pal-library-news-core', 'bbc-pal-newspopular', 'bbc-pal-jibbajabba']
repo = 'bbc-test'
info = `yum info #{packages.join(' ')} --verbose --enablerepo=#{repo} | egrep '(Name)|(^Version)|(Arch)|(Release)|(Buildtime)|(^$)'`
rpm = {}
info.split(/\n/).each do |line|
tokens = line.split(/:/)
@commuterjoy
commuterjoy / gist:1391581
Created November 24, 2011 15:26 — forked from jcleveley-zz/1-developer.md
Grade 8 Job Requirements - Senior Web Developer

Essential

Software craft

  • Experience of Test Driven Development and automated Acceptance Tests with Cucumber.
  • Ability to write good quality OO code including patterns and refactoring.
  • Healthy interest in upcoming web standards and technology.

Performance

@commuterjoy
commuterjoy / gist:1391614
Created November 24, 2011 15:35
Grade 7 Job Requirements - Web Developer

Essential

Software craft

  • Experience of Test Driven Development and automated Acceptance Tests with Cucumber.
  • Ability to write good quality OO code including patterns and refactoring.
  • Healthy interest in upcoming web standards and technology.

Languages

@commuterjoy
commuterjoy / gist:1416553
Created December 1, 2011 12:58
Load testing pal.stage with and without mod_cache
siege -c 100 -t 90s -f scripts/3000.weighted.random
Transactions: 11010 hits
Availability: 100.00 %
Elapsed time: 89.97 secs
Data transferred: 120.51 MB
Response time: 0.79 secs
Transaction rate: 122.37 trans/sec
Throughput: 1.34 MB/sec
Concurrency: 97.20
@commuterjoy
commuterjoy / gist:1446621
Created December 8, 2011 10:08
Graphing a pattern in your subversion history
# Today I wanted to draw a graph of the growth of our Cucumber scenarios in our
# ./feature directory since it's inception. It's in subversion, which provides
# rubbish history search support. Rubbish as in none whatsoever.
export REPO=http://path/to/your/features/directory
svn log $REPO |
egrep '^r[0-9]{1,}' |
cut -d ' ' -f 1 |
awk -v repo=$REPO '{print "svn export --force -" $1 " " repo " " $1 " 2>&1"}' |
@commuterjoy
commuterjoy / gist:1476082
Created December 14, 2011 10:41
PHP 5.4 traits to emulate AOP
<?php
// There's a few nasty AOP implementations in PHP that either
// rely on code generation or reflection. PHP 5.4 should allow us
// to define the horizontal concerns using _traits_
// - ref. http://php.net/manual/en/language.oop5.traits.php
/**
* A class that does something. Nice, clean. Just business logic.
**/
@commuterjoy
commuterjoy / gist:1521474
Created December 26, 2011 15:52
Incremental backup script
#!/bin/sh
# incremental backup script, tar and rsync's any file modified since the script last ran
CONTROL=/Users/user/Backups/backup.control
DEST=/Users/user/Backups/`date +%Y%m%d`-24hrs
DESTTAR=/Users/user/Backups/`date +%Y%m%d`
# create a tarball of modified files
mkdir -p $DEST
@commuterjoy
commuterjoy / gist:1576369
Created January 7, 2012 22:54
Inline documentation of system commands
# Was trying to figure out a nice way to document oblique system
# commands embedded in a ruby script. I think a nice way is to
# write inline comments then gsub them out and collapse newlines
# before running system().
uri = 'http://example.com'
command = ("curl
-i # print header
-L # follow HTTP 302s
@commuterjoy
commuterjoy / bowling.js
Created February 7, 2012 14:37
Bowling
// allow summing of any numerical array
Array.prototype.sum = function(){
return this.reduce(function(prev, current){
return prev + current;
});
};
// hold the game - basically an array of competitors
var Game = function(){
@commuterjoy
commuterjoy / gist:1792208
Created February 10, 2012 19:52
notes about project
How often can you really watch a project under construction? Rarely. Occasionally you read a case study or how we made ​​of a known site, but that is always talking afterwards. Then we often talk about how beautiful and well it has become, and are often problems or challenges with a "oh, that was all right 'aside. But what if you could see them during the construction of a new version of one of the world's biggest news?
The BBC is always trying to innovate and improve their huge site. They are currently busy with a responsive web design and this complex process is performed on a test site called Responsive News . On its blog , the team explained what they encounter and how they experienced certain things and problems overcome. Very instructive. Also check the video with a number of experiments in action.
http://www.webdesignermagazine.nl/nieuws/volg-de-bbc-tijdens-het-maken-van-een-nieuwe-responsive-nieuwssite/4096