Skip to content

Instantly share code, notes, and snippets.

@lovett
lovett / phing-upgrade-wordpress
Created November 21, 2010 20:57
Phing task for upgrading WordPress
<target name="wordpress.upgrade">
<property name="tmp" value="/tmp" />
<property name="src" value="${tmp}/wordpress" />
<delete dir="${src}" includeemptydirs="true" failonerror="true" />
<exec dir="${tmp}" command="curl -s http://wordpress.org/latest.tar.gz | tar -xz" />
<delete dir="wp-admin" includeemptydirs="true" failonerror="true" />
<delete dir="wp-includes" includeemptydirs="true" failonerror="true" />
<move file="wp-config.php" tofile="wp-config.php.bak" overwrite="true"/>
@lovett
lovett / phing-adhocfilehash
Created November 21, 2010 20:56
Phing task for revving filenames of static assets during deployment
<adhoc-task name="adhocFilehash">
<![CDATA[
class AdHocFileHash extends Task {
private $path;
private $propertyName;
function setPath($path) {
$this->path = $path;
}
@lovett
lovett / relpath-img-tag
Created November 21, 2010 20:53
Figure out the relative path from the current buffer to the specified file; Create an image tag from the specified file path
(defun relpath (file &optional skipinsert)
"Figure out the relative path from the current buffer to the specified file"""
(interactive "FPath: ")
(let* (
(basePath
(file-name-directory
(expand-file-name
(buffer-file-name (current-buffer)))))
(targetPath
(expand-file-name file))
@lovett
lovett / emacs-arrange-frame
Created November 21, 2010 20:50
Set the width, height, and x/y position of the current emacs frame
(defun arrange-frame (w h x y)
"Set the width, height, and x/y position of the current frame"
(let ((frame (selected-frame)))
(delete-other-windows)
(set-frame-position frame x y)
(set-frame-size frame w h)))
(arrange-frame 160 50 2 22)