Skip to content

Instantly share code, notes, and snippets.

View ralphsaunders's full-sized avatar

Ralph Saunders ralphsaunders

View GitHub Profile
@ralphsaunders
ralphsaunders / controller.php
Created August 29, 2011 08:41
Loading a view with templates in Codeigniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/site
* - or -
@ralphsaunders
ralphsaunders / index.html
Created October 31, 2011 14:52
Basic Canvas Animation
<!doctype html>
<html>
<head>
<title>Canvas Stuff</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="./scripts.js"></script>
</head>
<body id="index">
<canvas id="canvas" width="900" height="900">
<!-- Fallback men, fallback! -->
@ralphsaunders
ralphsaunders / index.html
Created November 14, 2011 19:21
Switch GA Code based on URL Hash
<!doctype html>
<html>
<head>
<title>Index</title>
<script type="text/javascript">
var _gaq = _gaq || []; // GA array to push to
/**
@ralphsaunders
ralphsaunders / index.hmtl
Created December 26, 2011 10:42
Loading Feed Entries With The Google Feeds API
<!doctype html>
<html>
<head>
<title>Google Feeds API</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body id="index">
@ralphsaunders
ralphsaunders / hn.user.js
Created May 14, 2012 17:29
Hacked News Userscript, for a better Hacker News
// ==UserScript==
// @name Hacked News
// @match https://news.ycombinator.com/*
// @match http://news.ycombinator.com/*
// @description For a tidier Hacker News
// @version .01
// ==/UserScript==
var css = '<style type="text/css">'
// Wildcards
@ralphsaunders
ralphsaunders / colorwires.py
Created May 17, 2012 08:02
MCEdit filter for colour coding redstone circuits in Minecraft
# Authored by Seth Bling
# http://www.youtube.com/watch?v=3YaoSAaou7U
def perform(level, box, options):
groups = RedstoneGroups(level)
for x in xrange(box.minx, box.maxx):
for y in xrange(box.miny, box.maxy):
for z in xrange(box.minz, box.maxz):
groups.testblock((x, y, z))
@ralphsaunders
ralphsaunders / stupid.php
Created June 12, 2012 21:31
PHP preg_grep() throws a notice when passed array
/**
* This is my array, let's call him larry
*
* array(1) {
* ["canvas-snake"]=>
* array(5) {
* ["name"]=>
* string(12) "canvas-snake"
* ["server_path"]=>
* string(48) "/Applications/MAMP/htdocs/pl/posted/canvas-snake"
@ralphsaunders
ralphsaunders / directory_structure.txt
Created July 10, 2012 20:51
An example directory structure turned into HTML by payload.
|~posted/
|~articles/
|~an-article/
|-index.html
|-image.png
`-styles.css
|~another-article/
|-index.html
`-styles.css
|~portfolio/
@ralphsaunders
ralphsaunders / errors.md
Created November 6, 2012 01:31
I broke Homebrew

ralph:~ ralphsaunders$ brew install postgresql ==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2 Already downloaded: /Users/ralphsaunders/Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2 ==> Patching patching file src/pl/plpython/Makefile patching file contrib/uuid-ossp/uuid-ossp.c ==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.1 --datadir=/usr/local/Cellar/postgresql/9.2.1/share/postgresql --docdir=/usr/local/C checking for inflate in -lz... no configure: error: zlib library not found If you have zlib already installed, see config.log for details on the

@ralphsaunders
ralphsaunders / errors.md
Created November 6, 2012 01:31
I broke Homebrew
ralph:~ ralphsaunders$ brew install postgresql
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2
Already downloaded: /Users/ralphsaunders/Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2
==> Patching
patching file src/pl/plpython/Makefile
patching file contrib/uuid-ossp/uuid-ossp.c
==> ./configure --prefix=/usr/local/Cellar/postgresql/9.2.1 --datadir=/usr/local/Cellar/postgresql/9.2.1/share/postgresql --docdir=/usr/local/C
checking for inflate in -lz... no
configure: error: zlib library not found

If you have zlib already installed, see config.log for details on the