Skip to content

Instantly share code, notes, and snippets.

View DuffleOne's full-sized avatar

Laura DuffleOne

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Windows.Forms;
public class Chorus {
Dog fluffles;
Dog jake;
Dog harry;
Dog kim;
@DuffleOne
DuffleOne / Class.Fish.js
Created October 16, 2012 20:18
Javascript Fish Class
// JavaScript Document
function Fish(na, im, w, h, sw, sh, sf) {
/* Private Var Declarations */
var name = na;
var image = im;
var height = h;
var width = w;
var start_height = sh;
header('Content-type: text/xml');
$term = $_GET['value'];
$col = $_GET['column'];
$xmlDom1 = new DOMDocument();
$xmlString = '';
foreach ( file("http://stuweb.cms.gre.ac.uk/~mg109/COMP1688/index.php?col=$col&term=$term" ) as $node ) {
$xmlString .= trim($node);
}
@DuffleOne
DuffleOne / gist:659617c9fc24337d96e8
Created January 3, 2015 12:46
Example Symfony Console Command with CLImate
#! /usr/bin/env php
<?php
require_once 'vendor/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
<?php
// Show Contact
public function contact()
{
return View::make('pages.about.contact')->withInput([]);
}
// Process Contact
public function processContact()
### Keybase proof
I hereby claim:
* I am Duffleman on github.
* I am duffleman (https://keybase.io/duffleman) on keybase.
* I have a public key whose fingerprint is 695B AA12 2ECF 024C FFCF DD55 EFE1 8E88 7921 BFC1
To claim this, I am signing this object:
@DuffleOne
DuffleOne / Transition.php
Last active August 29, 2015 14:17
Copy tables, (with changes), from an old table set to a new table set. Uses Laravel atm
private function copy($table, $changes = array(), $matches = array(), $ignoreID = true) {
if(is_array($table)) {
$oldTable = $table[0];
$newTable = $table[1];
} else {
$oldTable = $table;
$newTable = $table;
}
@DuffleOne
DuffleOne / redditlulz.php
Last active August 29, 2015 14:21
Demo for a Redditor
<?php
// Imagine this extends Eloquent Model
class Article {
protected $image;
protected $api;
// You don't inject the Image or the API
// But you do build them up inside the Model.
@DuffleOne
DuffleOne / PushmanSpec.php
Created May 21, 2015 23:26
Base spec for Pushman PHP Library
<?php
namespace spec\Pushman\PHPLib;
use GuzzleHttp\Client;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Stream\Stream;
use GuzzleHttp\Subscriber\Mock;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
@DuffleOne
DuffleOne / ackermann.php
Created June 21, 2015 20:46
25 Minutes and 22 Seconds to run ack(4,1);
<?php
function ack($m, $n)
{
if (!is_integer($m) or ! is_integer($n)) {
throw new Exception('$m and $n must be integers.');
}
if ($m == 0) {
return $n + 1;