Skip to content

Instantly share code, notes, and snippets.

View kemo's full-sized avatar
💭
killing it

kemo

💭
killing it
  • Sarajevo, Bosnia and Herzegovina
  • X @delalick
View GitHub Profile
@kemo
kemo / php__call_benchmark.php
Created November 22, 2022 12:46
php magic __call benchmark
<?php
class MagicMethodFixture {
/**
* @var array
*/
protected $configurations;
public function __construct() {
$this->configurations = array(
@kemo
kemo / Kohana_3_4.md
Last active August 29, 2015 13:58 — forked from rjd22/Kohana_3_4.md

Kohana 3.4

Features

  • Kohana core - isolated autoloader/module loader/filesystem and cache (@zombor already started this iirc)

Fixes

  • Move Request::factory() into Request_Factory

Improvements

  • Database should support Mysqli
@kemo
kemo / gist:8196358
Created December 31, 2013 12:53
3.4 ORM object dump - bs free!
object Model_User(16) {
protected _validation => NULL
protected _object => array(6) (
"id" => string(1) "1"
"email" => string(23) "[email protected]"
"username" => string(4) "kemo"
"password" => string(64) "ab1bed09899950fe87a5d30495362b362398015b5d22d5e2ce4f781a7ef91bdd"
"logins" => string(2) "10"
"last_login" => string(10) "1388421310"
)
(string) mukuru-card
echo ( ! $a == 'mukuru-card') ->
FALSE
echo ($a != 'mukuru-card') ->
FALSE
(string)
echo ( ! $a == 'mukuru-card') ->
TRUE
echo ($a != 'mukuru-card') ->
@kemo
kemo / fix.diff
Last active July 16, 2018 06:47
Kohana 2 ob_end_clean() hotfix (PHP 5.4+)
diff --git a/system/core/Kohana.php b/system/core/Kohana.php
index 271f917..287c271 100644
--- a/system/core/Kohana.php
+++ b/system/core/Kohana.php
@@ -722,7 +722,7 @@ final class Kohana {
if (ob_get_level() >= self::$buffer_level)
{
// Set the close function
- $close = ($flush === TRUE) ? 'ob_end_flush' : 'ob_end_clean';
+ $close = ($flush === TRUE) ? 'ob_end_flush' : 'Kohana::_ob_end_clean';
@kemo
kemo / Security.php
Created May 6, 2012 20:57
My Kohana 3.3 Security class with CSRF Validation helper method
<?php defined('SYSPATH') or die('No direct script access.');
class Security extends Kohana_Security {
protected static $_logout_token_name = 'logout_token_key';
public static $csrf_field = 'token';
/**
* Creates a validation object to check if the field specified
@kemo
kemo / Cached.php
Created April 27, 2012 21:36
Cache-powered ORM model extension (Kohana 3.3) - [!!] Not tested
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Extend this class if you want your model cached. Example usage:
*
* 1. Model
* class Model_User extends ORM_Cached {}
*
* 2. Usage
*
@kemo
kemo / ssl_certificates.crt
Created April 26, 2012 07:03
List of verified SSL certificates
##
## ca-bundle.crt -- Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Sun Feb 19 04:03:37 2012
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
##
@kemo
kemo / Weather.php
Created April 20, 2012 21:20
Google Weather helper class for Kohana (fixed days and a bug with caching)
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Google (unofficial) Weather API Helper
*
* @author Kemal Delalic <[email protected]>
*/
class Weather {
protected static $_days = array(
'Mon' => 'Monday',
@kemo
kemo / jsrocks.js
Created April 16, 2012 07:32
JavaScript Rocks DOM inspect widget by @madrobby
// Just save the JS below as a bookmark and click it while on the page you wish to inspect
javascript:(function(){var script=document.createElement('script');script.type='text/javascript';script.src='http://javascriptrocks.com/tools/dommonster.js?'+(new Date().getTime());document.getElementsByTagName('body')[0].appendChild(script);})()