Skip to content

Instantly share code, notes, and snippets.

View duellsy's full-sized avatar

Chris Duell duellsy

View GitHub Profile
@duellsy
duellsy / view.blade.php
Last active December 17, 2015 09:58
Check that a section has content in a laravel view, so you can determine if you want to display certain wrapping content etc
@if($__env->yieldContent('messages') != '')
<div class="messages">
<h1>Messages</h1>
@yield('messages')
</div>
@endif
<?php
/**
* Ranking Library
* contains alogrithms for story ranking
* Basically a PHP Implementation of reddits algorithms
*
* @author Lucas Nolte <lnolte@i.biz>
* @since 0.1
* @package Polska Wiadomosc
* @subpackage Libraries
@duellsy
duellsy / custom sort.php
Created June 16, 2011 00:38
custom sort
function sortbydate($a,$b){
if($a['date']>$b['date'])
return 1;
else if($a['date']<$b['date'])
return -1;
return 0;
}
@duellsy
duellsy / Box shadow.css
Created June 16, 2011 00:37
Box shadow
-moz-box-shadow: 0 1px 3px black;
-webkit-box-shadow: 0 1px 3px black;
box-shadow: 0 1px 3px black;
@duellsy
duellsy / method 404 catch
Created February 17, 2011 01:38
Send user to 404 page if controller exists but method does not (add to MY_Controller.php)
function _remap($method) {
if (in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
$uri = $this->uri->segment_array();
unset($uri[1]);
unset($uri[2]);
call_user_func_array(array($this, $method), $uri);
}
else {
redirect('404');