Skip to content

Instantly share code, notes, and snippets.

@deizel
deizel / TestSuite\Fixture\SchemaFixture.php
Last active August 29, 2015 14:08
Auto-load fixture fields from Config/Schema/schema.php (depends on Migrations plugin)
<?php
App::uses('MigrationShell', 'Migrations.Console/Command');
/**
* Schema Reader - reads schema.php from disk
*
* Steals functionality from private method in Migrations.MigrationShell::_getSchema()
*/
class SchemaReader extends MigrationShell {
@deizel
deizel / cakephp.template
Created November 12, 2014 17:54
CakePHP template (for use with gelstudios/gitfiti project)
:cakephp
[[0,0,0,1,1,1,1,2,0,0,0,0,1,3,3,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,2,4,4,4,0,0,2,4,0,2,4,0,2,4,4,4,0,0],
[0,0,1,1,1,3,1,1,2,0,0,1,3,2,2,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0,0,0,0,0,2,4,0,3,4,0,2,4,0,2,4,0,2,4,0,3,4,0],
[0,0,1,1,1,4,3,3,4,0,1,3,0,0,0,0,0,1,3,3,0,0,1,3,0,1,3,0,0,1,3,3,0,0,2,4,0,3,4,0,2,4,0,2,4,0,2,4,0,3,4,0],
[0,0,2,1,1,1,4,3,4,0,1,3,0,0,0,0,0,0,0,2,3,0,1,3,1,3,0,0,1,3,0,2,3,0,2,4,4,4,0,0,2,4,4,4,4,0,2,4,4,4,0,0],
[0,0,3,2,2,2,2,4,4,0,1,3,0,0,0,0,0,1,3,3,3,0,1,3,3,0,0,0,1,3,3,3,3,0,2,4,0,0,0,0,2,4,0,3,4,0,2,4,0,0,0,0],
[0,0,2,3,3,3,3,4,4,0,0,2,3,1,1,0,1,3,0,2,3,0,1,3,2,3,0,0,1,3,0,0,0,0,2,4,0,0,0,0,2,4,0,3,4,0,2,4,0,0,0,0],
[0,0,0,2,2,2,2,0,0,0,0,0,2,3,3,0,0,1,3,3,3,0,1,3,0,2,3,0,0,1,3,3,3,0,2,4,0,0,0,0,2,4,0,3,4,0,2,4,0,0,0,0]]
@deizel
deizel / ruleset.xml.diff
Created July 31, 2015 17:28
Temporary workaround for https://youtrack.jetbrains.com/issue/WI-17740 (~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/CakePHP)
diff --git i/ruleset.xml w/ruleset.xml
index 89c13c9..672d340 100644
--- i/ruleset.xml
+++ w/ruleset.xml
@@ -98,16 +98,16 @@
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.NamingConventions.ValidFunctionName">
- <exclude-pattern>*/src/*</exclude-pattern>
- <exclude-pattern>*/tests/*</exclude-pattern>
@deizel
deizel / collection.php
Created August 13, 2015 20:07
Example of CakePHP Collection
<?php
$countries = ['Denmark', 'Netherlands', 'France'];
$types = ['Italian', 'Japanese', 'Chinese'];
collection($countries)
->unfold(function ($country) use ($types) {
foreach ($types as $type) {
yield $country => $type;
}
})
chris:infinitas deizel$ git checkout dev
Switched to branch 'dev'
Your branch and 'origin/dev' have diverged,
and have 1 and 25 different commit(s) each, respectively.
chris:infinitas deizel$ git pull --rebase
First, rewinding head to replay your work on top of it...
Applying: adding netbeans to .gitignore
chris:infinitas deizel$
@deizel
deizel / save_diff.php
Created March 29, 2011 17:33
Handles saving only fields that have been changed in a record by the logged in user
<?php
/**
* SaveDiff component
*
* Handles saving only fields that have been changed in a record by the logged in user.
*
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
class SaveDiffComponent extends Object {
/**
➜ joind.in git:(master) ✗ vagrant up
[default] Importing base box 'centos-62-64-puppet'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 80 => 8080 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Running any VM customizations...
@deizel
deizel / test.pp
Created May 11, 2012 20:22
joindin test suite
# Set development values to php.ini
augeas { 'set-apache-conf-values':
context => '/files/etc/httpd/conf/httpd.conf',
changes => [
'set EnableMMAP/param off',
'set EnableSendfile/param off',
],
require => Service['apache'],
#notify => Service['apache'], # circular dependency?
}
@deizel
deizel / -
Created October 10, 2015 22:43
*** composer.lock 2015-10-07 20:19:52.000000000 -0500
--- /tmp/royalty/ApiGen/composer.lock 2015-10-10 17:28:03.000000000 -0500
***************
*** 6,9 ****
],
! "hash": "b9d08183efa4f1d45cb3c4a2523ffd8c",
! "content-hash": "b1bbcac7ab9bdbe9e02a4a0a4ce0ebaf",
"packages": [
--- 6,9 ----
],