Skip to content

Instantly share code, notes, and snippets.

View jwdunne's full-sized avatar

James W Dunne jwdunne

View GitHub Profile
require './ri'
class PrinterJobs < Interface
def queue_job; end
def cancel_job; end
end
class InkjetJobs
def queue_job
puts "Queuing job"
class Class
def my_method
puts "Hehe, my name is #{name}"
end
end
class Test
end
#include <stdio.h>
/* registers */
#define NUM_REGS 4
int regs[NUM_REGS];
/* program instructions */
int prog[] = {
0x1005, /* loadi r0 #5 */
0x1101, /* loadi r1 #1 */
<?php if ($_SERVER['REQUEST_URI'] == '/invisible-braces.html' || $_SERVER['REQUEST_URI'] == '/') { ?>
<a href="#june-offer" id="june-offer-link"></a>
<div style="display:none">
<div class="june-invisalign-offer" id="june-offer">
<img src="/images/invisalign2.jpg" alt="">
<h3>Invisalign Open Morning</h3>
<p>Invisalign open morning <strong>Saturday 7th June</strong><br />Book in for free consultation.</p>
</div>
</div>
<?php
/**
* Soule Content Management Framework
*
* Open Source, Super Simple CMF
*
* @package Soule
* @version 1.2.0
* @copyright 2011 - 2012 (c) devxdev.com
* @license http://soule.io/license
@jwdunne
jwdunne / gist:1249227
Created September 28, 2011 20:53
The SocialAnalyst Spec

Social Analyst (probably a mysnomer)

The social analyst is a basic app which discovers different groups of friends and any connections amongst them. It also allows you to query such data in interesting ways.

For example, how does one discover the connections between two sides of one's family? SocialAnalyst is the answer.

How does this work?

@jwdunne
jwdunne / gist:1247201
Created September 28, 2011 07:07
Request & Session usage
<?php
$sess = Session::init('foo');
$request = Request::requires(
Request::GET,
'love'
);
/*
if (! isset($sess->bar)) {
$sess->bar = 'baz';
@jwdunne
jwdunne / gist:1247199
Created September 28, 2011 07:04
Namespaced Sessions
<?php
session_start();
/**
* Session Class
*/
class Session {
private $namespace;
@jwdunne
jwdunne / gist:1247189
Created September 28, 2011 07:01
A request class
<?php
/**
* Request Class
*
* Allows code to use only the HTTP request variables they need
*/
class Request {
const GET = 'GET';
@jwdunne
jwdunne / gist:1052427
Created June 28, 2011 22:37
Bank account implementation in CLisp
(defclass customer ()
((balance :accessor customer-balance
:initarg :balance)
(acct-no :accessor customer-number
:initarg :ac-no)
(name :accessor customer-name
:initarg :name)))
; Constructor
(defun make-customer (acct-no name)