Skip to content

Instantly share code, notes, and snippets.

View realityking's full-sized avatar

Rouven Weßling realityking

View GitHub Profile
@realityking
realityking / gist:3571325
Created September 1, 2012 12:06
PHP fix for no admin template
$template = $db->loadObject();
if ($template !== null)
{
$template->template = JFilterInput::getInstance()->clean($template->template, 'cmd');
$template->params = new JRegistry($template->params);
}
else
{
$template = new stdClass;

The decoupled Symfony components have been a great help but there are a few things in FrameworkBundle that could be moved to the components with some small refactoring making them more useable for people like me who have to use the components without the full framework.

There's a pretty good chance I'm overlooking something with some of these and there are certainly backwards compatibility concerns to be adressed.

Let's dig in:

Router and RouterCacheWarmer

The warmUp() method from the Router class could be dropped (also the WarmableInterface), the code would move RouterCacheWarmer. With this change RouterCacheWarmer only depends on HttpKernel and Routing and could go into either of these components. (My favorite would be Routing)

Accept the following values:
-Any callable, i.e. 'my_callback_function'
-A string containing either
-just the class (is ControllerInterface is implemented) - behaves like it does right now
-or in the Syntax Class:Method - will create an instance of class and call method
<?php
$utf8_s = 'Iñtërnâtiônàlizætiøn';
$ascii_s = 'Internationalisation';
$utf8_m = 'Geocaching, auch GPS-Schnitzeljagd genannt, ist eine Art elektronische Schatzsuche oder Schnitzeljagd. Die Verstecke („Geocaches“, kurz „Caches“) werden anhand geografischer Koordinaten im World Wide Web veröffentlicht und können anschließend mit Hilfe eines GPS-Empfängers gesucht werden. Mit genauen Landkarten ist auch die Suche ohne GPS-Empfänger möglich. Ein Geocache ist in der Regel ein wasserdichter Behälter, in dem sich ein Logbuch sowie verschiedene kleine Tauschgegenstände befinden. Jeder Besucher trägt sich in das Logbuch ein, um seine erfolgreiche Suche zu dokumentieren. Anschließend wird der Geocache wieder an der Stelle versteckt, an der er zuvor gefunden wurde. Der Fund wird im Internet auf der zugehörigen Seite vermerkt und gegebenenfalls durch Fotos ergänzt. So können auch andere Personen – insbesondere der Verstecker oder „Owner“ – die Geschehnisse rund um den Geocache verfolgen. Weltweit existieren über 2
/* {{{ proto void register_shutdown_function(callback function) U
Register a user-level function to be called on request termination */
PHP_FUNCTION(register_shutdown_function)
{
php_shutdown_function_entry shutdown_function_entry;
int i;
zval ***args = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &shutdown_function_entry.arg_count) == FAILURE) {
@realityking
realityking / gist:9315991
Last active August 29, 2015 13:56
en/appendices/migrations56.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 332728 $ -->
<!--
Based on UPGRADING from PHP-5.6 circa alpha 1. Work in progress!
As we're still in alpha at the moment, I've only included relatively minimal
information here, and haven't updated the rest of the manual for 5.6 features
yet. Once we're well into betas/RCs and features are frozen, the information
in this appendix should be expanded and the new functionality integrated into
the rest of the manual.
@realityking
realityking / bench.php
Last active August 29, 2015 13:57 — forked from Rican7/bench.php
#!/usr/bin/env php
<?php
/**
* JSON/BSON encoding and decoding benchmark
*
* Now with native serializing!
*
* @copyright 2013 Trevor N Suarez
* @link http://blennd.com/
* @author Trevor Suarez <rican7@gmail.com>
@realityking
realityking / Travis Output
Last active August 29, 2015 13:58
Mockery Issue
Using worker: worker-linux-6-1.bb.travis-ci.org:travis-linux-4
travis_fold:start:git.1
$ git clone --depth=50 --branch=phpunit-broken git://github.com/realityking/swiftmailer.git realityking/swiftmailer
Cloning into 'realityking/swiftmailer'...
remote: Counting objects: 3010, done.
remote: Compressing objects: 0% (1/2027) 
remote: Compressing objects: 1% (21/2027) 
remote: Compressing objects: 2% (41/2027) 
remote: Compressing objects: 3% (61/2027) 
* thread #1: tid = 0x7ed76, 0x0000000100331817 php`zend_std_object_get_class_name(object=0x00000001058795f0, class_name=0x00007fff5fbfdc48, class_name_len=0x00007fff5fbfdc44, parent=0) + 167 at zend_object_handlers.c:1542, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
frame #0: 0x0000000100331817 php`zend_std_object_get_class_name(object=0x00000001058795f0, class_name=0x00007fff5fbfdc48, class_name_len=0x00007fff5fbfdc44, parent=0) + 167 at zend_object_handlers.c:1542
frame #1: 0x00000001002ee20f php`zend_get_object_classname(object=0x00000001058795f0, class_name=0x00007fff5fbfdc48, class_name_len=0x00007fff5fbfdc44) + 79 at zend_API.c:250
frame #2: 0x0000000100309fa3 php`zif_get_class(ht=1, return_value=0x000000010598e7d0, return_value_ptr=0x000000010068ff20, this_ptr=0x0000000000000000, return_value_used=1) + 355 at zend_builtin_functions.c:771
frame #3: 0x000000010038edba php`zend_do_fcall_common_helper_SPEC(execute_data=0x0000000100690038) + 1370 at ze
<html>
<head>
<style>
.something {
font: 700 300px sans-serif;
position: absolute;
}
</style>
<script>
function animate(element, color) {