Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Fabian Graßl fabeat

🎯
Focusing
  • deepblue networks AG
  • Hamburg
Block or report user

Report or block fabeat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scale.py
from PIL import Image
def scale(image, max_size, method=Image.ANTIALIAS):
"""
resize 'image' to 'max_size' keeping the aspect ratio
and place it in center of white 'max_size' image
"""
im_aspect = float(image.size[0])/float(image.size[1])
out_aspect = float(max_size[0])/float(max_size[1])
if im_aspect >= out_aspect:
View PropelObjectFormatter.php
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
View gist:1348985
<?php
class Page extends SiteTree {
//...
function canPublish($Member = null)
{
if (Director::is_cli())
{
return true;
}
else
View de_DE.php
<?php
global $lang;
$lang['de_DE']['Uploadify']['SUCCESSFULADDSINGLE'] = 'Datei "%s" hinzugefägt.';
$lang['de_DE']['Uploadify']['SUCCESSFULADDMULTI'] = 'Dateien hinzugefügt.';
$lang['de_DE']['Uploadify']['BUTTONTEXT'] = 'Durchsuchen';
$lang['de_DE']['Uploadify']['CHANGEFOLDERACTION'] = 'ändern';
$lang['de_DE']['Uploadify']['CHOOSEIMPORTFOLDER'] = 'Ordner wählen';
$lang['de_DE']['Uploadify']['PLEASESELECT'] = 'Ordner wählen';
$lang['de_DE']['Uploadify']['IMAGES'] = 'Bilder';
View test.php
<?php
class Foo
{
protected $bar = 'TEST';
}
$foo = new Foo();
$bar = new ReflectionProperty($foo, 'bar');
$bar->setAccessible(true);
echo $bar->getValue($foo);
View input.php
<?php
$arr = array('foo ', ' bar ');
$arr = array_map(function($el){ return trim($el); }, $arr);
var_dump($arr);
@fabeat
fabeat / gist:731908
Created Dec 7, 2010
Unit tests of protected methods in PHP
View gist:731908
<?php
class Foo
{
protected function bar($test)
{
echo $test;
}
}
@fabeat
fabeat / README
Created May 4, 2010
MYSQL SLUG FIX (Unique fix)
View README
MYSQL SLUG FIX
The table 'content' contains pages with a slug. This slug should be unique but it isn't.
unique_fix.sql fixes this problem and makes the slug-column unique.
You can’t perform that action at this time.