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
## By Luke Morton | |
# Set up caching on media files for 1 year (forever?) | |
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> | |
ExpiresActive On | |
ExpiresDefault A29030400 | |
Header append Cache-Control "public" | |
</FilesMatch> | |
# Force media to revalidate |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Shift Check</title> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<h1>Shift Check</h1> | |
<p>Try the following combos:</p> | |
<ul> |
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 defined('SYSPATH') or die('No direct script access.'); | |
class Controller_CMS extends Controller { | |
public function action_page() | |
{ | |
$page = $this->request->param('id', 'home'); | |
} | |
} |
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 | |
require_once('Mustache.php'); // Ensure feature/higher-order-sections branch !! | |
class MyMustache extends Mustache { | |
public function name() | |
{ | |
return "Luke"; | |
} |
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 | |
require_once('MustacheLambda.php'); // Ensure feature/higher-order-sections branch !! | |
class MyMustache extends Mustache { | |
public function name() | |
{ | |
return "Luke"; | |
} |
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 | |
/** | |
* ArrayPlay. | |
* | |
* An handy class for sorting arrays, more features as required. | |
* | |
* @author Luke Morton | |
* @example | |
* $original = array( | |
* array('name' => 'James', 'age' => 25), |
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 defined('SYSPATH') or die('No direct script access.'); | |
class Controller_Page extends Controller { | |
public function action_unpublish() | |
{ | |
$validation = Model_Page::unpublish($this->request->param('id'), $this->user); | |
if ($errors = $validation->errors()) | |
{ | |
$this->response->body( |
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 Text extends Kohana_Text { | |
public static function long_words($string, $max_length = 20, $elipsis = '...') | |
{ | |
$words = preg_split('/\s/', $string); | |
$elipsis_length = strlen($elipsis); | |
foreach ($words as $_word) |
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 | |
$logger = new Logger_Pimple(array( | |
'log_remote_endpoint' => 'https://secure.freeola.com', | |
'log_remote_user' => 'luke', | |
'log_remote_password' => 'luke', | |
)); | |
$logger['log']->add(0, 'An error occured'); |
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 | |
// Find user | |
$user = Model_User::find($id) | |
// Change name | |
->set('first_name', 'Luke') | |
// Save using default store | |
->save() |