Skip to content

Instantly share code, notes, and snippets.

<?php
App::import('Core', array('Media', 'HttpSocket'));
class UploadSocket extends HttpSocket {
/**
* upload function
* allows posting of multipart form data (aka file uploads)
*
@mgirouard
mgirouard / action.php
Created October 17, 2010 03:51
How to enable 'admin_' prefixed routes in Lithium
<?php
/* ----- snip (omitting everything already in config/bootstrap/action.php) ----- */
/**
* Filter to capture any admin-specific requests
* This simply updates the internal action name for dispatching purposes. In order for this to
* properly work across the board, you'll need to enable a persistent param for `admin` in your
* routes configuration. Something to the effect of the following will do nicely:
*
@funkatron
funkatron / chrometest.sh
Created February 9, 2011 15:20
To do testing on local HTML/JS apps in Chrome, I start it with this script to disable some security checks.
#!/bin/bash
# USAGE: /path/to/chrometest <localfile.html>
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--disable-web-security \
--allow-file-access-from-files \
--allow-file-access \
--log-level 3 \
$@
@jperras
jperras / programmer_prayer.txt
Created April 18, 2011 20:41
The programmer's prayer.
Our root,
who art in Unix,
hallowed be thy shell.
Thy kernel come.
Thy commands be run
@localhost as they are in iNet.
Give us this day our daily updates,
And forgive us for our four-oh-threes,
as we forgive those who 403 against us.
And lead us not into segfaults,
@redoPop
redoPop / ordered_containable.php
Created April 28, 2011 13:48
CakePHP Behavior that makes ContainableBehavior respect a Model's default order
<?php
/**
* Behavior to enhance CakePHP ContainableBehavior by respecting default Model order
*
* Makes ContainableBehavior respect Model::order when no other order is specified in
* the containment. Must be placed before ContainableBehavior in the actsAs array of
* the Model being queried, like so:
*
* var $actsAs = array('OrderedContainable', 'Containable');
*
@claylo
claylo / cf-invalidate.php
Created June 5, 2011 17:09
How to invalidate items in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php
@raphaelstolt
raphaelstolt / php54_php53_pear_macports.markdown
Created May 17, 2012 21:37
Installing PHP 5.4 and 5.3 side by side on Max OSX via MacPorts

##Given Apache 2 and MySQL are already installed.

#Update MacPorts sudo port selfupdate;sudo port -u upgrade outdated

#Install PHP 5.4.* sudo port install php54 php54-apache2handler ##Activate Apache Module cd /opt/local/apache2/modules

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@redoPop
redoPop / tzAbbr.js
Last active May 17, 2024 04:05
JavaScript: friendly timezone abbreviations in the client ("EDT", "CST", "GMT", etc.)
/*
Given a date, tzAbbr returns a short, friendly name for the
user's time zone on that date, or an empty string if their
client's Intl support is missing or incomplete.
For example, a user in New York might see:
tzAbbr(new Date()) // => "EST"
Time zones are locale-dependent. Users traveling outside of
@Maksold
Maksold / local.xml
Last active May 28, 2021 20:02
#magento #xml - local.xml boilerplate
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->