This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Page extends SiteTree { | |
//... | |
function canPublish($Member = null) | |
{ | |
if (Director::is_cli()) | |
{ | |
return true; | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
protected $bar = 'TEST'; | |
} | |
$foo = new Foo(); | |
$bar = new ReflectionProperty($foo, 'bar'); | |
$bar->setAccessible(true); | |
echo $bar->getValue($foo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array('foo ', ' bar '); | |
$arr = array_map(function($el){ return trim($el); }, $arr); | |
var_dump($arr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
protected function bar($test) | |
{ | |
echo $test; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |