Skip to content

Instantly share code, notes, and snippets.

View dragoonis's full-sized avatar

Paul Dragoonis dragoonis

View GitHub Profile
<?php
function cacheGet($key) {
$cache = new PPI\Cache\Redis();
if($cache->exists($cacheKey)) {
$someData = $cache->get($cacheKey);
} else {
$cacheData = array('my_cache' => 'data');
$someData = $cache->set($cacheKey, $cacheData, 86400);
}
/* {{{ proto bool SplHeap::clear() U
Clear the datastructure of all its elements */
SPL_METHOD(SplHeap, clear)
{
int i;
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM no
root@Bestbuys:~# cat /etc/ssh/sshd_config | more
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
<?php
namespace App\Model\Blog;
class Comment extends \PPI\DataSource\ActiveQuery {
protected $_meta = array(
'conn' => 'mysql',
'primary' => 'id',
'fetchmode' => \PDO::FETCH_ASSOC,
'table' => 'ppi_blog_comment'
);
<?php
namespace App\Mashup\Supplier\Product;
use App\Mashup\Supplier\OfferInterface;
class DefaultOffer implements OfferInterface
{
private $_id;
<?php
namespace App\Data\Gifts;
class Recipient extends \PPI\DataSource\ActiveQuery {
protected $_meta = array(
'conn' => 'main',
'table' => 'giftsdotcom_meta',
'primary' => 'id',
);
<?php
$connections = array();
$connections['main'] = array(
'type' => 'pdo_mysql',
'hostname' => 'localhost',
'database' => 'gifts',
'username' => 'root',
'password' => ''
);
$params['helper'] = new \App\Helper\View(array(
'baseUrl' => $this->getConfig()->system->base_url
));
function makeLink(array $options) {
$url = $this->_baseUrl . 'finder/index/';
if(isset($options['location'])) {
$location = str_replace(' ', '-', $options['location']);
$url .= 'location/' . $location . '/';
}
if(isset($options['category'])) {
$category = str_replace(' ', '-', $options['category']);
$url .= 'category/' . $category . '/';
}
<?php foreach($categories as $c): ?>
<?php
$title = $helper->escape($c->getTitle());
$link = $helper->makeLink(array(
'category' => $c->getCode()
));
?>
<li><a href="<?= $link; ?>" title="<?= $title; ?>"><?= $title; ?></a></li>
<?php endforeach; ?>