Skip to content

Instantly share code, notes, and snippets.

View kingpabel's full-sized avatar

Imtiaz Ahmed kingpabel

View GitHub Profile
@kingpabel
kingpabel / gist:f22649ca19ccfb99ecfe
Last active August 29, 2015 14:28 — forked from dominicmartineau/gist:5957140
Laravel 4: How to redirect to 404 page after exception thrown. Simply add a redirect to your 404 page at the end of 'App::error()' into app/start/global.php. You should return to your 404 page only if debug is not enabled.
App::error(function(Exception $exception, $code)
{
Log::error($exception);
if (Config::get('app.debug') == false) {
return Redirect::route('404');
}
});
<?php
$previousUrl = $_SERVER['HTTP_REFERER'];
$previousRoute = parse_url($previousUrl);
$previousRoute = $previousRoute['path'];
?>
app.filter('secondsToDateTime', [function() {
return function(seconds) {
return new Date(1970, 0, 1).setSeconds(seconds);
};
}])
html:
<b>{{seconds | secondsToDateTime | date:'HH:mm:ss'}}</b>
var myApp = angular.module('myApp', [], function ($interpolateProvider) {
$interpolateProvider.startSymbol('{kp');
$interpolateProvider.endSymbol('kp}');
});
<?php
$result = CustomerQuery::create()->filterByCreatedAt(array('min' => $startDate, 'max' => $endDate))
->select(array('ID', 'Name', 'CreatedAt'))
->addGroupByColumn('DATE(created_at)')
->find();
?>
<?php
$products = array (
1 => array(
'id' => 125,
'name' => 'The Breville One-Touch Tea Maker',
'slug' => 'breville-one-touch-tea-maker-BTM800XL',
'shortname' => 'The One-Touch Tea Maker',
),
2 => array(
<?php
$string ="<?xml version='1.0'?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
; with sane limits
xdebug.var_display_max_depth = 5
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024
; with no limits
; (maximum nesting is 1023)
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
<?php
$array = array('alias' => 'aliasOne', 'location_id' => 1);
$model = new Client();
$model->fromArray($array, BasePeer::TYPE_FIELDNAME);
$model->save();
install memcached
sudo apt-get install php5-memcached memcached
enable memcached module
sudo php5enmod memcached
restart php5-fpm
sudo service php5-fpm restart