Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""
Create a new function based on the current line
Examples:
Line: myFunction
Output: a function with the name myFunction
params = {
:font_size => 10
}
# 1
defaults = {
:font => "Times-Roman",
:font_size => 11,
:stroke => false
}
find . -name ._* -not -path *.svn* -exec svn rm {} \;
<?php
class A {
public $id;
public function __construct($id){
$this->id = $id;
}
}
<?php
public function resize($new_w, $new_h, $preserve=false){
$name = $this->image;
$e = $this->getExtension();
$filename = dirname($this->image) .'/'. $e['file'] .'_'. $new_w .'x'. $new_h . $e['extension'];
// this function only works if the imagecreatefromjpeg function exists
if(!function_exists('imagecreatefromjpeg')){ return false; }
// adapted from http://icant.co.uk/articles/phpthumbnails/