Skip to content

Instantly share code, notes, and snippets.

View rynop's full-sized avatar

Ryan Pendergast rynop

View GitHub Profile
$devices = $this->find('first',array(
'contain'=>array(
'Device'=>array(
'fields'=>array('id','name'),
'conditions'=>array('Device.public'=>1,'Device.deprecated'=>0)
)
),
'fields'=>array('id'),
'conditions'=>array('Ad.id'=>$adId)
)
@rynop
rynop / html
Created February 24, 2011 16:05
<a class="cat" rel="<?php echo $action['ClickAction']['click_action_type_id'].'/'.$action['ClickAction']['displayorder']; ?>" href="#"><?php echo $action['ClickAction']['title']; ?></a>
<span class="positionBut"><a href="#" class="moveUp"><img src="http://static.adagogo.com/img/icons/leftgreyarrow.png" /></a><a href="#" class="moveDown"><img src="http://static.adagogo.com/img/icons/rightgreyarrow.png" /></a></span>
<div class="theAction" style="display: none"></div>
@rynop
rynop / ie sucks
Created March 17, 2011 03:25
bad
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="http://media2.juggledesign.com/qtip2/js/excanvas.pack.js"></script><![endif]-->
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#make a memcache daemon.
function makememcached {
DNAME=memcached_$1
<?php
class Foo extends AppModel {
var $name = 'Foo';
var $virtualFields = array(
'tot_impressions' => 'COALESCE(SUM(Foo.impressions),0)',
'tot_clicks' => 'COALESCE(SUM(Foo.clicks),0)', //This is initial ad clicks
);
....
top - 18:41:25 up 26 days, 2:18, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 106 total, 1 running, 105 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.2%st
Mem: 606492k total, 357132k used, 249360k free, 169852k buffers
Swap: 0k total, 0k used, 0k free, 48836k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22159 memcache 20 0 72300 9864 888 S 0.0 1.6 0:01.87 memcached
16565 memcache 20 0 69100 5732 0 S 0.0 0.9 0:05.82 memcached
23593 root 20 0 215m 5712 1592 S 0.3 0.9 0:00.79 php5-fpm
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
use epoll;
}
free -m
total used free shared buffers cached
Mem: 7933 3597 4336 0 288 1058
-/+ buffers/cache: 2250 5683
Swap: 5721 0 5721
free -m
total used free shared buffers cached
Mem: 592 348 243 0 165 47
-/+ buffers/cache: 134 457
Swap: 0 0 0
sudo cat /etc/php5/fpm/conf.d/xdebug.ini
zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=0