Skip to content

Instantly share code, notes, and snippets.

View jwdunne's full-sized avatar

James W Dunne jwdunne

View GitHub Profile
@jwdunne
jwdunne / css-dropdowns.html
Created June 28, 2011 19:54
CSS Dropdowns
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>test</title>
<style type="text/css" media="screen">
.subnav {
padding-left: 0;
margin-left: 0;
}
@jwdunne
jwdunne / gist:1052049
Created June 28, 2011 20:05
isWithdrawable method
/**
* Determines if the given amount is withdrawable which is defined as:
* amount must be more than or equal to zero.
* amount must be less than or equal to balance
* @author James W. Dunne
*/
public boolean isWithdrawable(double amount) {
if (amount < 0 || amount > balance) {
return false
}
@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)
@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:1247199
Created September 28, 2011 07:04
Namespaced Sessions
<?php
session_start();
/**
* Session Class
*/
class Session {
private $namespace;
@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: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?

<?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
<?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>
#include <stdio.h>
/* registers */
#define NUM_REGS 4
int regs[NUM_REGS];
/* program instructions */
int prog[] = {
0x1005, /* loadi r0 #5 */
0x1101, /* loadi r1 #1 */