Skip to content

Instantly share code, notes, and snippets.

View dave1010's full-sized avatar

Dave Hulbert dave1010

View GitHub Profile
@dave1010
dave1010 / php-timezone-conf.sh
Created December 4, 2013 16:53
PHP timezone config
#!/bin/bash
echo "date.timezone = Europe/London" > /etc/php5/conf.d/timezone.ini
ln -s /etc/php5/conf.d/timezone.ini /etc/php5/apache2/conf.d/
ln -s /etc/php5/conf.d/timezone.ini /etc/php5/cli/conf.d/
@dave1010
dave1010 / de-resolve-symlinks.php
Created November 5, 2013 14:23
De-resolve symlinks from PHP's __FILE__
@dave1010
dave1010 / bamboo-install.sh
Last active February 23, 2017 23:19
Setup Bamboo
#!/bin/bash
# bamboo
mkdir /opt/atlassian
wget -O /opt/atlassian/bamboo.tar.gz http://www.atlassian.com/software/bamboo/downloads/binary/atlassian-bamboo-5.1.1.tar.gz
cd /opt/atlassian
tar xzf bamboo.tar.gz
mv atlassian* bamboo
mkdir /home/bamboo
@dave1010
dave1010 / README.md
Last active December 19, 2015 05:09
Here's a quick test to make sure you really are awesome.

Base are looking to hire an awesome Midweight Front-end Developer

Here's a quick test to make sure you really are awesome.

  1. Create a HTML page: left half a Google Map, right half a donut chart
  2. Get the JSON(P) data from http://api.opendevicelab.com/?countries=United%20Kingdom
  3. add all the device labs' locations as markers on the Google Map
  4. sum up all the brands_available values and show as percentages on the donut chart (eg 20 labs with Apple devices, out of a total of 50 brands_available values = 40%)

Bonus points:

@dave1010
dave1010 / continuous-integration-server.sh
Created May 24, 2013 08:44
Run unit tests whenever a file changes - a very basic CI server
#!/bin/bash
# watches for modified files in current directory (".") and "../src"
# runs phpunit when things change
# also requires inotify-tools
# make by dave1010. WTFPL
# future:
# * just use a real CI server
# * better email notifications
@dave1010
dave1010 / template.php
Created March 5, 2013 22:58
Really basic PHP templating
function template($string, $replace){
$keys = array_map(function($k) {
return '{'.$k.'}';
}, array_keys($replace));
$vals = array_values($replace);
return str_replace($keys, $vals, $string);
}
echo tempate("Hello {name}, today is {weather}!", array(
@dave1010
dave1010 / placeholder.js
Created November 22, 2012 11:15
HTML5 placeholder polyfill
if (!Modernizr.input.placeholder) {
// Old IE doesn't support the placeholder attribute on <input>
// TODO: placeholder colour and remove when submitting form
$(function() {
$('input[placeholder]').each(function() {
var ths = $(this), placeholder = ths.attr('placeholder');
if (!ths.val()) {
ths.val(placeholder);
}
ths.focus(function() {
@dave1010
dave1010 / jquery.blink.js
Created November 19, 2012 15:25
Blink tag support for WebKit
@dave1010
dave1010 / gist:3135160
Created July 18, 2012 09:05
WordPress classes
$ ack --php 'class [\w]+'|grep -v '//'|grep -v '*'|grep -v '>'|sed 's/.*class //'|sed 's/ .*//'
WP_Widget
WP_Widget_Factory
WP_Embed
Moxiecode_JSONReader
Moxiecode_JSON
Moxiecode_Logger
GoogleSpell
PSpell
SpellChecker
<?php
interface DatabaseAdapterInterface
{
public function connect();
public function disconnect();
public function prepare($sql, array $options = array());
public function execute(array $parameters = array());