Skip to content

Instantly share code, notes, and snippets.

View ikkez's full-sized avatar

Christian Knuth ikkez

View GitHub Profile
@Golpha
Golpha / Readme.md
Last active December 17, 2022 16:48
PHP Object-hacks without Reflections: Injectors and Closure Binding References

PHP Object-hacks without Reflections

Sometimes it is needed to manipulate private and protected properties of instances. The common way to do this is to manipule the visibility of the targeted properties using class reflection, but there is a more memory and performance efficient way to accomplish this task.

Reading and writing private and protected properties using injectors

At first injectors are not standardized nor described along design patterns, i choose Injectors as the name for this mechanic because of their major usage. The explicit technical name could be: IO-Adapters for invisible properties. Injectors do use closure binding with a explicit class scope. So, whatever you want to modify does require knowledge about the implementation details of the targeted parameters, as you should have when directly using closure binding.

The Injector class
@exodus4d
exodus4d / schema.php
Created December 23, 2015 02:15
MySQL Schema extension for f3-cortex
<?php
/**
* Created by PhpStorm.
* User: Exodus
* Date: 19.12.2015
* Time: 12:47
*
* This is an "on top" extension for "Schema Builder"
* see: https://github.com/ikkez/f3-schema-builder
*
@radmen
radmen / README.md
Created September 10, 2012 08:15
Apache vhost config for gitlab

unicorn config file

Edit file /home/gitlab/gitlab/config/unicorn.rb

Find line listen "#{app_dir}/tmp/sockets/gitlab.socket" and comment it. Uncomment line listen "127.0.0.1:8080"

required modules for apache

  • sudo a2enmod proxy
  • sudo a2enmod proxy_balancer
@cowboy
cowboy / ba-detach.js
Created April 23, 2011 16:43
JavaScript detach: detach a node from the DOM, optionally reattaching it when done.
/*!
* JavaScript detach - v0.2 - 5/18/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
function detach(node, async, fn) {
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,