Skip to content

Instantly share code, notes, and snippets.

@majna
majna / keybase.md
Created September 30, 2014 07:10
keybase.md

Keybase proof

I hereby claim:

  • I am majna on github.
  • I am majna (https://keybase.io/majna) on keybase.
  • I have a public key whose fingerprint is B2A0 DB74 3D75 65E0 0D5E E24D 24DD A85C C419 3608

To claim this, I am signing this object:

@majna
majna / .gitconfig
Last active December 31, 2015 15:09
My global .gitconfig
[user]
...
[core]
autocrlf = input
excludesfile = ~/git_ignore_global
[color]
ui = true
[color "diff"]
whitespace = red reverse
[github]
@majna
majna / AppExceptionRenderer.php
Created November 8, 2013 17:46
Customize the controller used by CakePHP Exception Renderer
<?php
App::uses('ExceptionRenderer', 'Error');
/**
* Put this file in app/Lib/Error
* and confgure the Exception handler in app/Config/core.php to use
* 'renderer' => 'AppExceptionRenderer' instead
*/
class AppExceptionRenderer extends ExceptionRenderer{
@majna
majna / AppTestShell.php
Last active December 14, 2015 10:39
Generate code coverage report in text format (app/Console/Command/AppTestShell.php)
<?php
App::uses('TestShell', 'Console/Command');
class AppTestShell extends TestShell {
public function getOptionParser() {
$parser = parent::getOptionParser()
->addOption('coverage-text', array(
'help' => __d('cake_console', '<file> Generate code coverage report in text format'),
'default' => false
@majna
majna / plugin_config.php
Created March 5, 2012 12:51
Plugin configuration
<?php
// Response to https://groups.google.com/forum/?fromgroups#!topic/cake-php/5rp9qIh2O9E
// Problem:
CakePlugin::load('CoolPlugin', array(
'config1' => 'value1',
'config2' => true,
'config3' => array(
'subkeyA' => 'valueA',
'subkeyB' => 'valueB'
)
@majna
majna / gist:1925077
Created February 27, 2012 16:25 — forked from fennb/gist:1283573
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@majna
majna / facebook.php
Created November 13, 2011 10:57
Cakephp 2 custom Facebook Auth adapter
<?php
App::uses('BaseAuthenticate', 'Controller/Component/Auth');
/**
* Uses the Facebook Connect API to log in a user through the Auth Component.
*
*/
class FacebookAuthenticate extends BaseAuthenticate {
/**
@majna
majna / index.diff
Created October 8, 2011 16:43
Sync webroot/index.php with skel/webroot/index.php
diff --git a/lib/Cake/Console/Templates/skel/webroot/index.php b/lib/Cake/Console/Templates/skel/webroot/index.php
index ab94654..b5b1d63 100644
--- a/lib/Cake/Console/Templates/skel/webroot/index.php
+++ b/lib/Cake/Console/Templates/skel/webroot/index.php
@@ -52,11 +52,11 @@
* This should point at the directory containg `Cake`.
*
* For ease of development CakePHP uses PHP's include_path. If you
- * need to squeeze a bit more performance you can set this path.
+ * cannot modify your include_path set this value.
@majna
majna / Dispatcher.php
Created July 7, 2011 18:47
pull #144
diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php
index 23c0ad2..0d53c24 100644
--- a/lib/Cake/Routing/Dispatcher.php
+++ b/lib/Cake/Routing/Dispatcher.php
@@ -92,7 +92,7 @@ class Dispatcher {
));
}
- if ($this->_isPrivateAction($request)) {
+ if ($this->_isPrivateAction($request) || !is_callable(array($controller, $request->params['action']))) {