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);
View gist:731908
<?php
class Foo
{
protected function bar($test)
{
echo $test;
}
}
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.