Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / OauthAuthorize.php
Created June 22, 2012 15:10
Florian code for OauthAuthorize
<?php
App::uses('BaseAuthorize', 'Controller/Component/Auth');
class OauthAuthorize extends BaseAuthorize {
public function authorize($user, CakeRequest $request) {
$Acl = $this->_Collection->load('Acl');
$Oauth = $this->_Collection->load('Oauth');
$user = array($this->settings['userModel'] => $Oauth->user());
return $Acl->check($user, $this->action($request));
}
}
@simkimsia
simkimsia / installation.txt
Created July 20, 2012 08:07
install cakephp, nginx, php, mysql for fresh version of mac
Today, Apple added a beautiful new package to their official developer tools suite: Command Line Tools for Xcode. It's a 171 MB download that includes all of the tools a Homebrew should ever need. Best of all, it contains the proprietary headers that I couldn't ship myself.
You can download and try it out today. All you need is a free Apple ID.
You'll want to uninstall Xcode first:
$ sudo /Developer/Library/uninstall-devtools --mode=all
Major props to Apple for making this happen.
follow rest of instructions here http://www.rabblemedia.net/installing-nginx-php-fpm-and-mysql-drupal-osx-lion-homebrew
@simkimsia
simkimsia / table.php
Last active October 9, 2015 10:16
bootstrap 3 table
<table class="table table-striped table-borderless table-vcenter" style="table-layout:fixed;">
<tbody>
<?php foreach ($cartData as $id => $item) : ?>
<?php $hash = 'post_' . hash('md5', $id); ?>
<tr>
<form name="<?= $hash ?>" action="cart.php" method="POST">
<input type="hidden" value="<?= $id ?>" name="id" />
<input type="hidden" value="remove" name="action" />
</form>
<td class="col-md-1 text-center">
@simkimsia
simkimsia / index.html
Created September 23, 2012 04:00
turnjs + FileReader works but does not work for odd number of pages
<html>
<head>
<style type="text/css">
body{
overflow:hidden;
}
#flipbook{
width:400px;
height:300px;
@simkimsia
simkimsia / dndhtml5.html
Created September 25, 2012 07:16
dnd html5
<html>
<head>
<style type="text/css">
body{
overflow:hidden;
}
#droparea {
width:200px;
height:200px;
@simkimsia
simkimsia / post.html
Created September 25, 2012 10:11
basic html code for blog oppoin
<div class="stopandrespond" style="text-align:center;background-color:#b0c4de;border:1px solid black;">
<strong><font color="red">Stop and do this now.</font></strong>
<br />
If this step doesn't work for you,<a href="#respond">Tell Us!</a>
</div>
<?php
...
/**
* HTTP POST handler
*
* @return void|\Cake\Network\Response
*/
protected function _post()
<?php
namespace App\Exception;
use Cake\Core\Exception\Exception;
class InvalidAuthenticationException extends Exception
{};
@simkimsia
simkimsia / AclGrantDenyShell.php
Last active December 10, 2015 17:08
This is a Cake Shell class that helps to grant and deny access to users or groups based on controller actions. It calls the core AclShell by iterating through a list of permissions. I would love to write a Plugin for everyone to use, but I am not sure how to store the list of permissions in a way it is easy for everybody else to be able to use g…
<?php
class AclGrantDenyShell extends AppShell {
/**
* Contains instance of AclComponent
*
* @var permissions
*/