Skip to content

Instantly share code, notes, and snippets.

View graemetait's full-sized avatar

Graeme Tait graemetait

View GitHub Profile
### Keybase proof
I hereby claim:
* I am graemetait on github.
* I am graeme_ea (https://keybase.io/graeme_ea) on keybase.
* I have a public key ASBt8mP4oyyKUyQ2PBy9JBW27td-RjrPYdCIGeeK325VAgo
To claim this, I am signing this object:
@graemetait
graemetait / example_Author.php
Last active August 30, 2015 10:13 — forked from livkiss/example_Author.php
Example usage of Fractal with objects instead of arrays
<?php namespace Example;
class Author
{
private $id;
private $name;
public function __construct($id, $name)
{
$this->id = $id;
<?php
class Entity
{
public function __get($property)
{
if (property_exists($this, $property)) {
return $this->{$property};
}
}
}
@graemetait
graemetait / gist:3437897
Created August 23, 2012 15:47
Remove sidebar from Bootstrap docs
javascript:$('.bs-docs-sidebar').css({'float': 'none', 'width': 'auto'}); $('.bs-docs-sidenav').css({'position': 'relative', 'top': 'auto', 'width': 'auto'}); $('.container > .row > .span9').addClass('span12').removeClass('span9');
@graemetait
graemetait / gist:3181908
Created July 26, 2012 13:00
Ruby course - isbn 1
def check_isbn13(isbn)
total = 0
12.times do |i|
# puts i % 2
if i % 2 == 0
total += isbn[i].to_i
else
total += isbn[i].to_i * 3
end
end
<?php
class MyToroHandler extends ToroHandler {
public $tpl;
public function __construct() {
$this->tpl = new Template(TPL_PATH);
ToroHook::add('after_handler', function() { $this->tpl->display('layout.tpl.php'); });
}
}