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 | |
function transferTo($via, $from) { | |
extract($from); | |
$path = Media::short($file, $mimeType) . DS; | |
if (is_file($file)) { | |
$checksum = hash_file('adler32', $file); | |
} elseif (is_file($via['file'])) { | |
$checksum = hash_file('adler32', $via['file']); | |
} 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
#!/bin/bash -x | |
# | |
# http://blog.mozmonkey.com/2008/vpc-ie6-ie7-ie8-on-mac-os-x/ | |
# Requires: Q, VirtualBox | |
VERSION="$1" | |
IE_DOWNLOAD="http://download.microsoft.com/download/B/7/2/B72085AE-0F04-4C6F-9182-BF1EE90F5273/IE${VERSION}-XPSP3.exe" | |
WORK_DIR="/tmp/ievm" | |
mkdir $WORK_DIR |
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
/** | |
* Date.parse with progressive enhancement for ISO-8601 | |
* © 2010 Colin Snover <http://zetafleet.com> | |
* Released under MIT license. | |
*/ | |
(function () { | |
'use strict'; | |
var origParse = Date.parse; | |
Date.parse = function (date) { | |
var timestamp = origParse(date), minutesOffset = 0, struct; |
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 | |
public function beforeDelete($cascade = true) { | |
if (!$cascade) { | |
return true; | |
} | |
$result = $this->find('first', array( | |
'conditions' => array($this->primaryKey => $this->id), | |
'fields' => array('dirname', 'basename'), | |
'recursive' => -1 |
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 | |
/** | |
* Reusable Copyright Element for Lithium. | |
* | |
* Works without passing any options at all (except the `holder`), will make | |
* "smart" guesses. Allows customization by passing strings for `holder`, `object` | |
* or years for `begin` and `end`. | |
* | |
* Example Usage: | |
* ``` |
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
#!/bin/bash | |
# | |
# Language agnostic GIT pre commit hook. | |
# | |
# Copyright (c) 2013 Marius Wilms. | |
# All rights reserved. | |
# | |
# Distributed under the terms of the BSD 3-clause license. Redistributions | |
# of this file must retain the above copyright notice. For the full license | |
# text see: http://opensource.org/licenses/BSD-3-Clause. |
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 | |
use lithium\net\http\Media; | |
$injectDataIntoElements = function(array $elements = [], array $data = []) { | |
Media::applyFilter('view', function($self, $params, $chain) use ($elements, $data) { | |
$view = $chain->next($self, $params, $chain); | |
$view->applyFilter('_step', function($self, $params, $chain) use ($elements, $data) { | |
$whitelisted = in_array($params['params']['template'], $elements); |
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
#!/bin/bash | |
# | |
# Continuously checks online/offline status and notifies | |
# you when the status changes. Works only where the "say" | |
# command is available. | |
# | |
# Dedicated to the public domain. | |
# | |
last= |
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
#!/bin/bash | |
# Fill in your connection details. | |
DATABASE="blog" | |
COLLECTION="posts" | |
USER="" | |
PASS="" | |
# | |
AUTH="" |