Skip to content

Instantly share code, notes, and snippets.

@jaggy
jaggy / watch.rb
Last active August 29, 2015 13:56
Autorun PHPSpec with Observr [ https://github.com/kevinburke/observr ]
def run_phpspec
file = nil
unless ARGV[1].nil?
file = "spec/#{ARGV[1]}Spec.php"
end
command = "`which phpspec` run --format=pretty --no-code-generation -vv #{file}";
@jaggy
jaggy / ParseShell.php
Created February 12, 2014 05:26
Parse the PHPUnit watcher with the --testdox parameter and colorize the output
<?php
class ParseShell extends AppShell
{
function main()
{
$this->stdout->styles( 'pass', [ 'text' => 'green' ] );
$this->stdout->styles( 'fail', [ 'text' => 'red' ] );
@jaggy
jaggy / SetupShell.php
Created March 19, 2014 23:21
Just a quick setup for everything
<?php
class SetupShell extends AppShell{
function main(){
system('./Console/cake acl create aco root controllers');
system('./Console/cake AclExtras.AclExtras aco_sync');
$handle = curl_init();
<?php
/**
* Set up the application permissions
*
* @http_request(GET, /setup)
* @return void
*/
public function setup()
{
@jaggy
jaggy / PageableBehavior.php
Created March 22, 2014 23:54
CakePHP paging behavior to complement with my REST plug-in
<?php
class PageableBehavior extends ModelBehavior
{
/**
* A custom paginate
*
* @group scope
<?php
function sc_dropdown( $field, $repeater )
{
$plural = array();
foreach(get_field( $field ) as $singular){
$plular = $singular[ $repeater ];
}
<?php
/**
* A wordpress rewrite wrapper
*
* @param string $alias
* @param string $url
* @return null
*/
function connect( $alias, $url )
@jaggy
jaggy / disable_cando.conf
Created April 11, 2014 18:54
Disable Cando 11.6 on /etc/X11/xorg.conf
Section "InputClass"
Identifier "disable broken device"
MatchIsTouchscreen "on"
MatchProduct "Cando 11.6"
Option "Ignore" "on"
EndSection
@jaggy
jaggy / jquery.boilerplate.js
Last active January 29, 2017 04:03
jQuery boilerplate
/*
|--------------------------------------------------------------------------
| jQuery Boilerplate based on http://gregfranko.com/jquery-best-practices/#/8
| Author: jaggyspaghetti
| Gist at https://gist.github.com/jaggyspaghetti/10555076
|--------------------------------------------------------------------------
*/
(function(application) {
// avoid jQuery conflicts
{
"name": "",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
},
{
"type": "vcs",
"url": "https://github.com/jaggyspaghetti/rake-db-migrator.git"