Skip to content

Instantly share code, notes, and snippets.

View wildlyinaccurate's full-sized avatar
🐕‍🦺

Joseph Wynn wildlyinaccurate

🐕‍🦺
View GitHub Profile
@wildlyinaccurate
wildlyinaccurate / Git.md
Created October 24, 2011 06:53
A comparison of Git and SVN. Or, why you should switch to Git.
   	                                	  ,ad8888ba,   88           
                                   		d8"'    `"8b  ""    ,d     
                                   		d8'                  88     
                                   		88             88  MM88MMM  
                                   		88      88888  88    88     
                                   		Y8,        88  88    88     
                                   		 Y8a.    .a88  88    88,    
                                   		  `"Y88888P"   88    "Y888  
@wildlyinaccurate
wildlyinaccurate / recursive_array_search.php
Created April 23, 2012 21:39
PHP Recursive Array Search
<?php
/**
* Recursively search an array for a given value. Returns the root element key if $needle
* is found, or FALSE if $needle cannot be found.
*
* @param mixed $needle
* @param array $haystack
* @param bool $strict
* @return mixed|bool
@wildlyinaccurate
wildlyinaccurate / AccountControllerTest.php
Created July 9, 2012 22:00
Laravel Controller Test Case
<?php
require_once 'ControllerTestCase.php';
class AccountControllerTest extends ControllerTestCase
{
public function testSignupWithNoDataRedirectsAndHasErrors()
{
$response = $this->post('account@signup', array());
@wildlyinaccurate
wildlyinaccurate / queue.js
Created July 18, 2012 19:57
Really simple Javascript queueing system
var Queue = function() {
var isInit = false;
var queue = [];
return {
onInit: function(callback) {
if (isInit) {
callback();
@wildlyinaccurate
wildlyinaccurate / event.js
Last active February 12, 2021 01:05
Really simple Javascript custom event system
var Event = function() {
var self = this;
self.queue = {};
self.fired = [];
return {
fire: function(event) {
@wildlyinaccurate
wildlyinaccurate / akamai_not_cacheable_replayer.rb
Created August 1, 2012 13:44
Log replayer that flags URLs where the X-Check-Cacheable header returned by Akamai is NO
=begin
This script will replay an Apache log file and verify whether each request
is cacheable by Akamai.
To run the script, provide the log file and your Akamai origin host name as
arguments, for example:
replayer.rb /var/log/apache/access.log http://dsd-www.example.com.edgesuite-staging.net
=end
require 'net/http'
@wildlyinaccurate
wildlyinaccurate / Preferences.sublime-settings
Last active January 13, 2021 00:43
My Sublime Text configuration
{
"theme": "Soda Dark.sublime-theme",
"color_scheme": "Packages/Theme - Refined/Color Schemes/Monokai Refined.tmTheme",
"font_face": "Droid Sans Mono",
"font_size": 12,
"font_options": ["no_italic"],
"highlight_line": true,
"line_padding_top": 3,
"line_padding_bottom": 3,
@wildlyinaccurate
wildlyinaccurate / convert-tabs-and-trim-trailing-whitespace.sh
Last active December 11, 2015 22:59
Convert tabs to 4 spaces and trim any trailing whitespace
# This requires GNU sed (or any sed which supports -i) and expand
find . -type f -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
# It's better to be more specific about which files you want to run the replacement in, e.g.
find . -type f -name *.php -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
# You can use find's -regex option to match multiple extensions (you need to double-escape backslashes in bash):
find . -type f -regex .+\\\.\\\(php\\\|css\\\|js\\\)\$ -printf "sed -i 's/[ \t]*$//' %p && expand -t 4 %p > %p.tmp && mv %p.tmp %p\n" | sh
@wildlyinaccurate
wildlyinaccurate / watch.sh
Last active December 14, 2015 11:58
Simple script to run the CoffeeScript and Sass "watch" commands
#!/bin/bash
PIDFILE=".watch.pid"
touch $PIDFILE || (echo "Unable to write to .watch.pid" && exit 1)
# Kill off old processes
while read pid; do
kill $pid
done < $PIDFILE
@wildlyinaccurate
wildlyinaccurate / hack.sh
Last active December 17, 2015 02:49 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://gist.githubusercontent.com/wildlyinaccurate/5539084/raw/hack.sh | sh
#