Skip to content

Instantly share code, notes, and snippets.

View midorikocak's full-sized avatar
😎
cool

Midori Kocak midorikocak

😎
cool
  • Prague
View GitHub Profile
<?php
// src/Model/Entity/Record.php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Record Entity.
*/
class Record extends Entity {
@midorikocak
midorikocak / gist:c98fe9df8375bfd96449
Created November 30, 2014 17:25
saving associated data in cakephp 3
<?=$this->element('business_actions')?>
<div class="businesses form large-10 medium-9 columns">
<?= $this->Form->create($entity) ?>
<fieldset>
<legend><?= __('Add Business') ?></legend>
<?php
echo $this->Form->input('name');
echo $this->Form->input('url');
echo $this->Form->input('description');
echo $this->Form->input('businesses.0.businesstype_id', ['options' => $businesstypes]);
@midorikocak
midorikocak / gist:8706aaeb9fb505f3db9f
Created November 30, 2014 17:33
debug($record); CakePHP 3
/src/Controller/RecordsController.php (line 73)
object(App\Model\Entity\Record) {
'new' => false,
'accessible' => [
'name' => true,
'url' => true,
'description' => true,
'user_id' => true,
'user' => true,
@midorikocak
midorikocak / gist:3c8551f1d4f565e1f946
Created May 30, 2015 09:01
paletton generated theme for cakephp
/* CSS - Cascading Style Sheet */
/* Palette color codes */
/* Palette URL: http://paletton.com/#uid=33k0u0krEtvhbBXmbv9uanOyPiP */
/* Feel free to copy&paste color codes to your application */
/* As hex codes */
.color-primary-0 { color: #15858F } /* Main Primary color */
@midorikocak
midorikocak / website-checklist.md
Last active August 29, 2015 14:24
Website Project Checklist

Website Project

Collect Common Elements

  • Logo
  • Title
  • favicon.ico
  • Images
  • Keywords
  • Description
  • Icons
public static function main()
{
var appView:AppView = new AppView();
var todos:Todos = getTodos();
var todosView:TodosView = new TodosView();
appView.addToSection(todosView);
<html>
<head>
<title>Yazı yollama ekranı</title>
</head>
<body>
<form action="<?php echo $_SERVER [ 'PHP_SELF' ];?>" method="post">
Kullanıcı Adı: <input type="text" name="username"><br>
Şifre: <input type="password" name="password"><br>
Başlık: <input type="text" name="title"><br>
<textarea name="body" rows="4" cols="50" >Bu alan yazı gir
@midorikocak
midorikocak / gist:4260757
Created December 11, 2012 18:13
AuthakeComponent.php
<?php
/*
This file is part of Authake.
Author: Jérôme Combaz (jakecake/velay.greta.fr)
Contributors:
Authake is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@midorikocak
midorikocak / MediaTable.php
Created March 6, 2016 11:18
MediaTable for CakePHP 3.x for managing media like images on the app.
<?php
namespace App\Model\Table;
use App\Model\Entity\Media;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
use Cake\Routing\Router;
@midorikocak
midorikocak / null-coalescing-assignment-test.php
Created April 3, 2016 01:13
Tests for new Null Coalescing assignment Operator
<?php
class Test extends PHPUnit_Framework_TestCase
{
// https://www.reddit.com/r/ruby/comments/l2y8m/rubyists_already_use_monadic_patterns/c2pjlt8
public function testPHPImplementation(){
$a ?? $a = 5;
$this->assertTrue($a == 5);
$a ?? $a = 9;