Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mattclegg on github.
  • I am mattclegg (https://keybase.io/mattclegg) on keybase.
  • I have a public key ASCpFxA7u4eoV-yBj7YPp7v-QLTGhbghN-b9zvrXZJmKVQo

To claim this, I am signing this object:

@mattclegg
mattclegg / patch.diff
Created January 16, 2020 07:39
[PATCH] update aws-sdk to support credntial_source
From 5781029d31faa05f11fc0f774e45761d0e4d5a96 Mon Sep 17 00:00:00 2001
From: mattclegg <m@cle.gg>
Date: Wed, 15 Jan 2020 14:28:01 +0100
Subject: [PATCH] update aws-sdk only
---
Gopkg.lock | 6 +-
Gopkg.toml | 2 +-
.../github.com/aws/aws-sdk-go/aws/config.go | 2 +-
.../aws-sdk-go/aws/credentials/credentials.go | 9 +-
kshell() {
kubectl exec -it --namespace="$1" "$2" -- env TERM=$TERM COLUMNS=$COLUMNS LINES=$LINES sh -il
}
kdelete() {
kubectl delete pod --namespace="$1" $2
}
kpod() {
kubectl get pods --namespace=$1 -l$2 -o go-template="{{ range \$var,\$val := .items}}{{ if eq \$var 0 }}{{ \$val.metadata.name }}{{ end }}{{ end }}"
@mattclegg
mattclegg / gist:65c9aec0e43618c91b6b
Created January 4, 2016 20:05
Benchmark: PHP Reverse
<?php
$test_array = array(0,1,2,3,4,5);
function getmicrotime()
{
list($usec, $sec) = explode(' ',microtime());
return ((float)$usec + (float)$sec);
}

Now Native

PhpStorm now bundles WordPress coding style natively, starting from version 8.

  1. Go to Project Settings > Code Style > PHP.
  2. Select Set From... (top right of window) > Predefined Style > WordPress.

No longer need to muck with this import! :)

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
@mattclegg
mattclegg / MyAwesomePage.php
Created March 31, 2014 13:21
MyAwesomePage Validation for has_many fields (in the CMS)
<?php
class MyAwesomePage extends Page {
static $has_many = array(
"Things" => "AwesomeDataObjects"
);
public function getCMSFields() {
$fields = parent::getCMSFields();
@mattclegg
mattclegg / brew install
Last active December 26, 2015 23:29 — forked from braidn/brew install
brew install
@mattclegg
mattclegg / index.html
Created October 29, 2012 16:50
A CodePen by mattclegg. Animated Chrome logo with explode view
<div id="chrome">
<div id="mask"></div>
<div id="shadow"></div>
<div id="green"></div>
<div id="red"></div>
<div id="yellow"></div>
<div id="green2"></div>
</div>