Skip to content

Instantly share code, notes, and snippets.

View benjaminmullard's full-sized avatar

Ben Mullard benjaminmullard

  • Norwich, United Kingdom
View GitHub Profile
@benjaminmullard
benjaminmullard / keybase.md
Created May 3, 2018 10:07
Public verification for Keybase.io

Keybase proof

I hereby claim:

  • I am benjaminmullard on github.
  • I am benjaminmullard (https://keybase.io/benjaminmullard) on keybase.
  • I have a public key ASDycxRkVMm1fJMhJn9l5W8rz5C9TYMj6-wrkwgXPNmcJwo

To claim this, I am signing this object:

@benjaminmullard
benjaminmullard / MapPerformanceTest.java
Created May 19, 2015 16:32
Test performance of Map implementations
package uk.co.validus.billingserver.util;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
public int compareTo(Person other) {
int i = firstName.compareTo(other.firstName);
if (i == 0)
{
i = lastName.compareTo(other.lastName);
}
return i;
}
@benjaminmullard
benjaminmullard / install_xdebug_macosx.md
Last active August 29, 2015 14:14
Install xdebug on Mac OSX

Install autoconf

curl --remote-name http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar -xzvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local/autoconf-2.69
make
make install
cd /usr/local/

@benjaminmullard
benjaminmullard / custom_helper.php
Created February 6, 2015 21:07
CodeIgniter helper functions
<?php if (!defined('BASEPATH')) { exit; }
if (!function_exists('generate_uuid')) {
/**
* Generate a universally unique ID that can be used for sharding.
*
* @param integer $shard_id The ID to shard by.
* @param integer $seq Incrementing sequence for the database table.
* @return string Universally unique ID.
*/
@benjaminmullard
benjaminmullard / MY_Encrypt.php
Last active August 29, 2015 14:14
Extension to CI_Encrypt CodeIgniter library
<?php if (!defined('BASEPATH')) { exit; }
class MY_Encrypt extends CI_Encrypt {
public function __construct() {
parent::__construct();
}
/**
* Encrypt a given string using SHA512 encryption.
sudo mkdir -p /var/www/
cd /var/www/
sudo wget https://ghost.org/zip/ghost-latest.zip
sudo unzip -d ghost ghost-latest.zip
cd ghost/
sudo npm install --production
sudo vi config.example.js
# In 'Production' section, change:
# Current best practice is to install Node.js/NPM as root using sudo
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
node --version
@benjaminmullard
benjaminmullard / elasticsearch_commands.txt
Created January 22, 2015 20:48
Handy Elasticsearch commands
# List all indices
curl '127.0.0.1:9200/_cat/indices?v'
# Delete index
curl -XDELETE 127.0.0.1:9200/<index name>/
@benjaminmullard
benjaminmullard / install_cpanminus.txt
Created January 21, 2015 22:20
Install App::cpanminus on Ubuntu
apt-get update
apt-get upgrade
apt-get install perl build-essential curl
curl -L http://cpanmin.us | perl - --sudo App::cpanminus