Skip to content

Instantly share code, notes, and snippets.

Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');
@arnaud-lb
arnaud-lb / UseIndexWalker.php
Created May 15, 2012 19:27
USE INDEX / FORCE INDEX in a Doctrine2 DQL query
<?php
use Doctrine\ORM\Query\SqlWalker;
/**
* Quick hack to allow adding a USE INDEX on the query
*/
class UseIndexWalker extends SqlWalker
{
const HINT_USE_INDEX = 'UseIndexWalker.UseIndex';
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 18, 2024 10:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mbostock
mbostock / .block
Last active May 25, 2017 05:19 — forked from mbostock/.block
Geodesic Grid
license: gpl-3.0
@beberlei
beberlei / TxController.php
Created August 6, 2012 09:44
Transactional Service Proxy
<?php
class TxController extends Controller
{
public function context($id)
{
return new TxProxy($this->get($id), $this->get('doctrine.orm.default_entity_manager'));
}
}
@igorw
igorw / composer.json
Created October 6, 2012 13:41
React Chatroulette
{
"require": {
"react/socket": "0.2.*"
}
}
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@mxriverlynn
mxriverlynn / findkey.js
Created November 20, 2012 03:48
Find key by value, with underscore.js
function findKey(obj, value){
var key;
_.each(_.keys(obj), function(k){
var v = obj[k];
if (v === value){
key = k;
}
});
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't: