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 Controller_Admin extends \Controller { | |
protected $current_user = null; | |
protected $sortable = array(); // Used in action_sort for vars. | |
protected $filterable = array(); | |
public function action_index() | |
{ |
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
@columns: 12; | |
@column: 60px; | |
@gutter: 10px; | |
@page: (@column * @columns) + ((@gutter * @columns) * 2); | |
.row { | |
width: @page; | |
margin: 0 auto; | |
overflow: hidden; | |
} |
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 | |
public static function data_uri($data, $mime) | |
{ | |
return 'data:'.$mime.';base64,'.base64_encode($data); | |
} | |
public static function data_img($filename) | |
{ | |
if ( ! static::find_file($filename, static::$_folders['img'])) |
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 | |
return array( | |
'provinces' => array( | |
'AB' => 'Alberta', | |
'BC' => 'British Columbia', | |
'MB' => 'Manitoba', | |
'NB' => 'New Burnswick', | |
'NL' => 'Newfoundland and Labrador', |
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 | |
$glob = glob(APPPATH .'migrations/*_*.php'); | |
list($last) = explode('_', basename(end($glob))); | |
$file = APPPATH.'migrations/'.str_pad($last + 1, 3, '0', STR_PAD_LEFT).'_create_blog_tables.php'; | |
if ( ! file_put_contents($file, $content) | |
{ | |
throw new Exception('Cannot write migration.'); | |
} |
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 | |
// Block elements | |
$block = 'article,aside,blockquote,body,br,button,canvas,caption,col,colgroup,dd,div,dl,dt,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,map,object,ol,output,p,pre,progress,section,table,tbody,textarea,tfoot,th,thead,tr,ul,video'; | |
// Inline elements | |
$inline = 'a,abbr,address,area,audio,b,cite,code,del,details,dfn,command,datalist,em,font,i,iframe,img,input,ins,kbd,label,legend,link,mark,meter,nav,optgroup,option,q,samp,small,small,select,source,span,strong,sub,summary,sup,tbody,td,time,var'; | |
// Children can only be text nodes and should hold their format completely |
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
<!-- Got this from inside the gridz_app files | |
http://github.com/tschmidt/gridz_app | |
Other than that, I don't know where it's from, but I like it! --> | |
<h1>This document shows various HTML elements</h1> | |
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit Lorem ipsum dolor sit amet, volutpat. </p> | |
<h2>This is 2nd level heading bh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi luptatum zzril delenit Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam no</h2> | |
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p> |
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
Perl and PHP Regular Expressions | |
PHP regexes are based on the PCRE (Perl-Compatible Regular Expressions), so any regexp that works for one should be compatible with the other or any other language that makes use of the PCRE format. Here are some commonly needed regular expressions for both PHP and Perl. Each regex will be in string format and will include delimiters. | |
All Major Credit Cards | |
This regular expression will validate all major credit cards: American Express (Amex), Discover, Mastercard, and Visa. | |
//All major credit cards regex | |
'/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|622((12[6-9]|1[3-9][0-9])|([2-8][0-9][0-9])|(9(([0-1][0-9])|(2[0-5]))))[0-9]{10}|64[4-9][0-9]{13}|65[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})*$/' |
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 | |
namespace Atom\Encoder; | |
use Atom\Encodable; | |
class Base64 implements Encodable { | |
public function decode($data) | |
{ |
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 | |
use \Atom\DB\Connection as Conn; | |
class DB { | |
protected $connections = array(); | |
public static function connection($id = 'default', $config = null) | |
{ |
OlderNewer