Skip to content

Instantly share code, notes, and snippets.

View dave1010's full-sized avatar

Dave Hulbert dave1010

View GitHub Profile
@dave1010
dave1010 / htaccess
Created December 14, 2011 13:07
HTTP Status Cats Apache (htaccess) config
# HTTP Status Cats
# Apache (htaccess) config created by @dave1010
# Licensed CC BY 2.0
# Images CC BY 2.0, from GirlieMac's photostream:
# http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/
# Usage: copy save this file as .htaccess or add it to your httpd.conf
ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>'
@dave1010
dave1010 / jquery.log.js
Created February 16, 2012 11:45
jQuery console logger
/*!
* jQuery Console Logger v1.0
*
* Copyright 2012, Dave Hulbert
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Usage: add ".log()" inline in a jQuery chain
* $('div').parent().parent().log().find('span').next().log();
*/
jQuery.fn.log = function() {
<?php
interface DatabaseAdapterInterface
{
public function connect();
public function disconnect();
public function prepare($sql, array $options = array());
public function execute(array $parameters = array());
@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
@dave1010
dave1010 / jquery.blink.js
Created November 19, 2012 15:25
Blink tag support for WebKit
@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 / 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 / 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 / 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 / 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