Skip to content

Instantly share code, notes, and snippets.

@kieranajp
kieranajp / kieran.conf
Last active August 29, 2015 14:03
My Apache.conf
<VirtualHost *:80>
ServerName dev.vg
ServerAlias *.vg
UseCanonicalName Off
VirtualDocumentRoot "/vagrant/vagrant/%-2+/public_html"
<Directory /vagrant/vagrant>
AllowOverride All
Require all granted
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #

Keybase proof

I hereby claim:

  • I am kieranajp on github.
  • I am kieranajp (https://keybase.io/kieranajp) on keybase.
  • I have a public key whose fingerprint is 3BED 9D38 9A90 7BD4 E6C3 3B46 447F AB09 435F A749

To claim this, I am signing this object:

"""""
" Colors
"""""
syntax enable
"""""
" Spaces & Tabs
"""""
@kieranajp
kieranajp / bug report.md
Last active August 29, 2015 14:17
PerchAPI_Base.class.php hotfix

When posting a comment on a perch blog, we were receiving the following error:

ErrorException: Trying to get property of non-object in /Library/WebServer/Documents/dsear/public_html/perch/core/lib/api/PerchAPI_Base.class.php on line 19

This is on Perch 2.8.2 with the latest Blog app.

The comment was saving okay, but the error was thrown regardless. I did some digging and found it was due to Perch's logging.

To fix the error I modified the aforementioned class:

The traditional way of doing async in JS was with callbacks:

function doSomethingThatTakesAWhile(callback) {
    // blah blah blah doing some work that will take a few seconds

    // We'll simulate this taking a while with the timeout
    setTimeout(function () {
        callback('done');
 }, 5000)
@kieranajp
kieranajp / shipitbot.sh
Last active March 1, 2016 15:15
Slack webhook that can be run when a successful deploy happens (we run it through CodeShip CI)
#!/bin/bash
# Slack Info
webhook_url="" # Put your Slack webhook URL here
channel="#general"
# Deploy info
server="" # Staging, production etc.
check_url="" # Link within the message body
application_name="" # Name of your application
@kieranajp
kieranajp / .git_hooks_pre-commit
Created April 18, 2016 22:09
pre-commit hook to run phpcs
#!/bin/sh
PRE_COMMIT="$(cat <<'EOF'
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
@kieranajp
kieranajp / npm_s3.sh
Created July 1, 2016 14:16
Caches NPM install on S3 based on whether the shrinkwrap's changed.
#!/bin/bash
##########
# Run this to use a cached version of node_modules stored on Amazon S3.
# If npm-shrinkwrap has changed, the cache is updated.
#
# Ensure the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environtment variables are set
# Then run the script.
#
# Example:
@kieranajp
kieranajp / Dockerfile
Created September 28, 2016 13:16
Update alpine go dockerfile
FROM golang:1.7.1-alpine
RUN apk --update add make \
&& rm -rf /var/cache/apk/*