Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""
ignore_moves.py v0.2
Filter relocated lines from a unified diff format stream.
Offered under the terms of the MIT License at github.com
Taken from http://stackoverflow.com/questions/1380333/
"""
import sys
from optparse import OptionParser
@barryvdh
barryvdh / colorbox.less
Created March 10, 2012 18:49
Colorbox skin for Bootstrap
/*
ColorBox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:10001; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto;}
#cboxTitle{margin:0;}
@pgampe
pgampe / test ts
Created June 30, 2012 12:01
Show TYPO3 Typoscript security problem with insertData = 1
page >
page = PAGE
page.10 = COA_INT
page.10 {
10 = HMENU
10 {
special = directory
# a menu root page
special.value = 105
@pgampe
pgampe / TYPO3-Documentation-clone.sh
Created July 9, 2012 17:06
Clone all TYPO3 Documentation
#!/bin/bash
# This script is in the public domain.
# Based on an idea by Fabien Udriot
# see http://pastie.org/4225971
# Enter your username for typo3.org here. If no username is entered here, you
# will be promted for it during execution.
username=""
@ohader
ohader / forge-analyse.php
Last active December 10, 2015 11:38
Forge Issue Analysis
<?php
/**
* Usage:
* php forge-analyse.php <date-from> [<date-until>]
* php forge-analyse.php 2012-12-24 2012-12-31
*
* @author Oliver Hader <oliver.hader@typo3.org>
* @license GPL v2 or any later version
* @see http://forge.typo3.org/projects/typo3v4-core/wiki/FriendlyGhost
*/
@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:

@albarralnunez
albarralnunez / main.tex
Last active June 3, 2022 10:43
LaTeX - Template for presentation
% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
@fsuter
fsuter / gist:5803411
Last active November 22, 2022 10:18
The code samples below demonstrate how to register a custom soft reference parser for TYPO3 CMS. This consists of 3 steps: 1) register the soft reference parser key globally 2) add the soft reference parser key to the appropriate fields in the TCA 3) code the soft reference parser The example is taken from extension "templatedisplay".
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser'][$_EXTKEY] = 'Tesseract\Templatedisplay\Service\SoftReferenceParser';
@baschny
baschny / AdditionalConfiguration.php
Created November 16, 2013 12:47
TYPO3 CMS AdditionalConfiguration.php adaptations for easy use of "git bisect". If you want to use "git bisect" on 6.2 development, you end up having to change your configuration depending if certain features are in or not. This addition to AdditionalConfiguration.php help automating these changes for you at runtime depending if certain commit i…
<?php
# ...
function isCommitIncluded($commit) {
$cmd = sprintf('GIT_DIR=%s/.git git log -1 %s^..HEAD', PATH_site . 'typo3_src', $commit);
$output = '';
exec($cmd, $output);
return (count($output) > 0);
}
@NeoBlack
NeoBlack / cleanupFunctionalTestDatabases.sh
Last active August 29, 2015 14:21
shell script to remove functional test databases.
#!/bin/bash
################################################################################
# Cleanup databases after functional test runs
#
# call for a check:
# ./cleanupFunctionalTestDatabases.sh
# call for really delete databases:
# ./cleanupFunctionalTestDatabases.sh doit
################################################################################