Skip to content

Instantly share code, notes, and snippets.

Patrick Hamann phamann

Block or report user

Report or block phamann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
phamann / index.js
Created Mar 20, 2017
Delete all services within a Fastly acconut
View index.js
const fetch = require('node-fetch');
const API = '';
const TOKEN = process.env.FASTLY_API_TOKEN;
const OPTIONS = {
headers: {
'Fastly-Key': TOKEN,
'Accept': 'application/json'
View dummy.csv
id first_name last_name email gender ip_address
1 Jerry Simpson Male
phamann / worker.js
Last active Aug 29, 2015
Simple ServiceWorker for Guardian hackday
View worker.js
console.log("Worker startup");
this.oninstall = function(event) {
console.log('Worker install');
caches.create('static').then(function(cache) {
return cache.add(
phamann / Gruntfile.js
Created Oct 25, 2013
RequireJS example
View Gruntfile.js
requirejs: {
options: {
baseUrl: "common/app/assets/javascripts",
paths: {
"bean": "components/bean/bean",
"bonzo": "components/bonzo/src/bonzo",
"domReady": "components/domready/ready",
"EventEmitter": "components/eventEmitter/EventEmitter",
"qwery": "components/qwery/mobile/qwery-mobile",
"reqwest": "components/reqwest/src/reqwest",

Lesson's learnt building the Guardian

Below is a collection of my favourite responses I gathered from Guardian engineers when asked the question: What have you learnt starting from scratch and building a mobile-first next generation web platform for the Guardian?

Daithi O Crualaoich

  • Work with great people.
  • Deploy like crazy. This means the team has to control the infrastructure as well as code.
  • Design is not a service. Designers have to sit in the team.
  • Infrastructure is intrinsically unreliable. Discard and replace is the robust strategy.
  • Use your CDN for HTML too.
  • Don't always do as you are told.
phamann / routerExtend.js
Created Jun 13, 2013
Require.js for ben
View routerExtend.js
//You are using underscores extend so you need include it :)
define(['underscore'], function(_) {
//This could be some kind of utilities modules
//Define the extend method
var extend = function() {
_.extend(Backbone.Router.prototype, Backbone.Events, {
before: function() {},
after: function() {},
phamann / Network-Timing-API.js
Last active Dec 16, 2015
Example of gathering request timing information using the Navigation timing API
View Network-Timing-API.js
function getPerformanceData() {
var perf = window.performance || window.msPerformance || window.webkitPerformance || window.mozPerformance;
if (perf) {
var t = perf.timing;
return [
// Time required for domain lookup.
t.domainLookupEnd - t.domainLookupStart,
// Time to establish a connection to server.
t.connectEnd - t.connectStart,
View dom-ready.js
UTIL = {
exec: function( controller, action ) {
var ns = SITENAME,
action = ( action === undefined ) ? "init" : action;
if ( controller !== "" && ns[controller] && typeof ns[controller][action] == "function" ) {
phamann / button.css
Created Aug 22, 2012
Themeing Sencha Touch with SASS blog post
View button.css
.x-button.x-button-astonvilla {
background-image: none;
background-color: #650032;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #B20058), color-stop(50%, #7F003F), color-stop(51%, #650032), color-stop(100%, #4C0025));
background-image: -webkit-linear-gradient(top, #B20058, #7F003F 50%, #650032 51%, #4C0025);
background-image: linear-gradient(top, #B20058, #7F003F 50%, #650032 51%, #4C0025);
phamann / Preferences.sublime-settings
Created May 18, 2012
SublimeText2 - User preferences
View Preferences.sublime-settings
//Turn on tab completing over hitting enter
"auto_complete_commit_on_tab": true,
//Auto indenting on new line within block
"auto_indent": true,
//Mine is Solarized Dark
"color_scheme": "Your theme of choice",
You can’t perform that action at this time.