View laravel-upload-resize.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Resizer and Image Manipulation | |
// Based on: http://forums.laravel.com/viewtopic.php?id=2648 | |
public function post_edit_logo($id) | |
{ | |
$rules = array( | |
'image' => 'image', | |
); |
View ide_helper.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Auth extends Laravel\Auth {} | |
/** | |
* @method static add(string $name, string $source, array $dependencies = array(), array $attributes = array()) | |
* @method static string styles() | |
* @method static string scripts() | |
*/ | |
class Asset extends Laravel\Asset {} | |
class Autoloader extends Laravel\Autoloader {} | |
class Bundle extends Laravel\Bundle {} |
View Import.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Import.php */ | |
namespace App/Controllers; | |
use /App/Models/TermTaxonomy; | |
use /App/Models/Term; | |
class Import extends BaseController | |
{ | |
public function index() | |
{ |
View gist:6363439
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This needs some refactoring http://perishablepress.com/perfect-wordpress-title-tags-redux/ */ | |
if (function_exists('is_tag') && is_tag()) { | |
single_tag_title("Tag Archive for ""); | |
echo'" - '; | |
} elseif (is_archive()) { | |
wp_title(''); | |
echo ' Archive - '; | |
} elseif (is_search()) { | |
echo 'Search for "'.wp_specialchars($s).'" - '; |
View Explode String with punctuation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function explodeArrayFunction($input) | |
{ | |
$array = preg_split('/(\s|[\.,\/])/', $input, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); | |
return array_values($array); | |
} | |
function implodeArrayFunction($input) | |
{ |
View bench.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/** | |
* JSON/BSON encoding and decoding benchmark | |
* | |
* Now with native serializing! | |
* | |
* @copyright 2013 Trevor N Suarez | |
* @link http://blennd.com/ | |
* @author Trevor Suarez <rican7@gmail.com> |
View TestArrayWalk.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* TestArrayWalk | |
* | |
* This is the code I have used when describing an issue I had with array_walk, closures and referencing $this | |
* within PHP version 5.3.3. | |
* | |
* The original stackoverflow question can be seen here: | |
* http://stackoverflow.com/questions/19033184/using-this-when-not-in-object-context-error-within-array-walk | |
* |
View factorials.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time_start = microtime(true); | |
$iterations = 20; | |
header('Content-Type: text/plain'); | |
function convert($size) | |
{ | |
$unit=array('b','kb','mb','gb','tb','pb'); |
View .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prompt for user | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi | |
#prompt for root | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
View filters.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Cache Filters | |
|-------------------------------------------------------------------------- | |
| | |
| This filter can be attached to a route to easily add a simple caching | |
| layer. | |
| | |
| Use as a before and after filter. When fired after a request the cache |
OlderNewer