Skip to content

Instantly share code, notes, and snippets.

View shama's full-sized avatar
✍️
writing a status message

Kyle Robinson Young shama

✍️
writing a status message
View GitHub Profile
@shama
shama / cakeftp_mocks.php
Created October 26, 2011 21:02
Mocking up CakeFTP
/**
* testConnect
*/
public function testConnect() {
// FTP FAILED CONNECT
$this->FtpSource = $this->getMock('FtpSource', array('_ftp'), array($this->defaultConfig));
$callback = create_function('$method,$params', <<<END
if (\$method == "ftp_connect") {
return false;
@shama
shama / keyzoom.js
Created February 2, 2012 00:01
jmpress.js zoom in and out with + or -
/**
* Viewport Key Zoom In & Out
* Press + and - to zoom the viewport in and out.
*/
(function() {
'use strict';
$.jmpress("defaults").viewPort.keyZoomAmount = 100;
$.extend(true, $.jmpress('defaults').keyboard.keys, {
187: 'zoomin' // plus
,189: 'zoomout' // minus
@shama
shama / jmpress-step-events.html
Created March 14, 2012 05:03
How to use jmpress.js step events
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jmpress.js | how to use jmpress.js step events</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="jmpress.js"></script>
</head>
@shama
shama / FixAssertShell.php
Created March 23, 2012 06:39
Correct parameter order of assertions
<?php
App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
/**
* Fix Assert Shell
* Will correct the parameter ordering of assertEquals()
* Not perfect but gets most and only causes a few errors :)
*
* @author Kyle Robinson Young <kyle at dontkry.com>
@shama
shama / questionable-game.md
Created March 27, 2012 04:17
The Questionable Game

The Questionable Game

A game to play when answering questions in a support channel of an open source project to get people to read the docs.

How To Play

  • The player asks a question.
  • If the answer can be found in the docs/wiki, the player gets 1 point.
  • If the answer can be found in the readme, the player gets 1.5 points.
  • If the answer can be found with a google search, the player gets 0.5 points.
@shama
shama / cakephp_notes.md
Created March 30, 2012 05:02
shama's CakePHP Notes

shama's CakePHP Notes

A collection of notes as I use CakePHP and related projects. Could be items I plan to work on, misunderstandings or curiosities.

CORE

  • basics.php - debug()
    • Output bufferring doesn't work well with debug(), $var = print_r($var, true) can't be used with ob
    • Debug method, mouse over to display file location (it gets in the way)
  • Console
@shama
shama / ExamplesController.php
Created June 15, 2012 19:55
load helper in a controller... dont do this!
<?php
/**
* DONT DO THIS
* Just to show it is possible but if you are calling
* a helper from a controller then your code should likely
* be in a Model or Lib instead.
*/
class ExamplesController extends AppController {
public function index() {
@shama
shama / issue-guidelines.js
Created July 27, 2012 01:44
haunting a repo with issues disabled
var assert = require('assert');
module.exports = {
'pull-requests': {
'should log pull request object': function (pull) {
//assert.ok(/\-wip$/.test(pull.base.label))
console.log(pull);
}
}
}
@shama
shama / grunt-todo-list.md
Created July 31, 2012 23:36
grunt-todo-list
  • setup grunt-contrib-watch like handlebars
  • test grunt-hub on windows. Update chokidar usage in task to work like grunt-contrib-watch.
@shama
shama / gist:3279941
Created August 7, 2012 00:28
grunt windows test fails
Welcome to Git (version 1.7.11-preview20120710)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Kyle@OFFICE-WIN ~
$ cd Documents/grunt
Kyle@OFFICE-WIN ~/Documents/grunt (devel)