Skip to content

Instantly share code, notes, and snippets.

View ruthlessfish's full-sized avatar

Shane Pearson ruthlessfish

View GitHub Profile
#!/usr/bin/env php
<?php
// default value
$n = 10;
// set custom n value
if (isset($argv[1]) && is_int($argv[1])) {
$n = $argv[1];
}
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.17 (Ubuntu 12.17-0ubuntu0.20.04.1)
-- Dumped by pg_dump version 12.17 (Ubuntu 12.17-0ubuntu0.20.04.1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
@ruthlessfish
ruthlessfish / kohana.sh
Created August 20, 2012 20:31
Kohana from the command line
#!/bin/bash
#------------------------------------------------------------------------------
#
# Kohana
#
#
# Run Kohana controllers from the command line
#
# Installation:
#
@ruthlessfish
ruthlessfish / gameof15.html
Created March 14, 2012 18:31
Game of 15
<!DOCTYPE html>
<html lang="en">
<head>
<title>The Game of 15!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
div {
text-align:center;
}
@ruthlessfish
ruthlessfish / install-closure.sh
Created March 13, 2012 00:53
Google Closure Tools installer
#!/bin/bash
#
# Google Closure Tools installer
#
# Documentation: https://developers.google.com/closure/
#
INSTALL_PATH=/usr/local/share
#just in case
@ruthlessfish
ruthlessfish / MY_Hooks.php
Created November 12, 2011 03:30
Custom hooks with arguments
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* MY_Hooks Class
*
* Extends Hooks by allowing you to pass parameters on the fly
* with custom hook calls. Much of the logic is borrowed from the
* core CI_Hooks class.
*
* Ex:
*
@ruthlessfish
ruthlessfish / growl.php
Created September 12, 2011 23:03
Growl notifications in php
<?php
class Growl {
private $_command;
private $_valid_args = array('title', 'name', 'appicon', 'message', 'icon', 'iconpath', 'image', 'priority', 'identifier', 'wait', 'host', 'password', 'upd', 'port', 'auth', 'progress');
public function __construct($options = array())
{
if( ! empty($options))
@ruthlessfish
ruthlessfish / manifest.php
Created September 9, 2011 01:11
convert an array of files into a multi-dimensional array
<?php
/**
* Build Manifest
*
* Requires: PHP 5.3+
*
* Takes an array of file names and builds a multi-dimensional array
* representing a simple file-system.
*
* NOTE: Files are only currently supported as leaf elements in the array.
// namespace
var WTF = {};
// --------------------------------------------------------------------
// database configuration
WTF.dbConfig = {
'username': 'root',
'password': 'root',
'database': 'poopy',
@ruthlessfish
ruthlessfish / migrate.php
Created August 30, 2011 04:55
sample migration controller (CLI)
<?php
/**
* Sample Usage:
*
* $php index.php migrate version 5
* $php index.php migrate latest
* $php index.php migrate current
*
*/