Skip to content

Instantly share code, notes, and snippets.

View aranw's full-sized avatar

Aran Wilkinson aranw

View GitHub Profile
@aranw
aranw / gist:3981121
Created October 30, 2012 15:55
Artists Model
<?php
namespace Askonasholt;
class Artist extends \Eloquent
{
public static $timestamps = true;
public function category()
{
return $this->has_many_and_belongs_to('Askonasholt\Category');
@aranw
aranw / gist:4030437
Created November 7, 2012 09:44
overlay
<div id="overlay" class="lb">
<div class="media">
<img src="assets/images/content/lightbox-image.jpg" alt="" />
<div class="titlebar">
<a class="close">Close</a>
<p><span class="current">1</span> of <span class="total">25</span></p>
</div> <!-- titlebar -->
<div class="heading">
@aranw
aranw / album.php
Created November 9, 2012 11:42
Models
class Album extends \Eloquent
{
public static $timestamps = true;
public function artist()
{
return $this->belongs_to('Askonasholt\Artist');
}
public function image()
@aranw
aranw / gist:4062641
Created November 12, 2012 23:01
L4 Encrypter Bug
PHP Fatal error: Call to undefined function Illuminate\mcrypt_create_iv() in /Users/aran/Sites/blog/vendor/illuminate/encryption/src/Illuminate/Encrypter.php on line 54
Fatal error: Call to undefined function Illuminate\mcrypt_create_iv() in /Users/aran/Sites/blog/vendor/illuminate/encryption/src/Illuminate/Encrypter.php on line 54
@aranw
aranw / PostController.php
Created November 13, 2012 13:16
Bug with phpunit Laravel 4
public function showPost($post = null)
{
$view = View::make('blog.post');
$view->with('title', "Aran Wilkinson - "); // We need to get the post title
$view->with('post', $this->posts->getPostBySlug($post));
//
// Get the requested blog post
// If it doesn't exist give 404 error
//
public function showPost($post = null)
{
$view = View::make('blog.post');
$view->with('title', "Aran Wilkinson - "); // We need to get the post title
$view->with('post', $this->posts->getPostBySlug($post));
//
// Get the requested blog post
// If it doesn't exist give 404 error
//
@aranw
aranw / PostController.php
Created November 15, 2012 10:04
Laravel 4 Tests
<?php
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class NoPostsException extends Exception {}
class PostController extends Controller
{
/**
@aranw
aranw / PageController.php
Created November 24, 2012 12:24
Caching issue
<?php
class PageController extends Controller {
/**
* Blog Posts
*
* @var array
**/
protected $posts;
@aranw
aranw / gist:4189982
Created December 2, 2012 17:18
CSS BEM
<article class="post">
<h2 class="post__header"><a href="" class="post__header--link">title</a></h2>
@aranw
aranw / gist:4258305
Created December 11, 2012 12:45
Github Status Graphing JS
(function() {
$(function() {
var render, renderGraphs;
render = function(data, canvas) {
var add_gradient, area, bad_at, dateEnd, dateStart, daySpan, format, gradient, h, line, lines, main_path, max, min, numdays, padb, padl, padr, padt, subs, ticks, timeFormat, transition, units, vis, w, warn_at, x, xAxis, y, yAxis, yax, _ref;
w = canvas.width();
h = canvas.height();
units = canvas.attr('data-unit');
add_gradient = canvas.attr('data-warn-at') != null;