Skip to content

Instantly share code, notes, and snippets.

View ROFL.php
$this->xml[] = '<?xml version="1.0" encoding="UTF-8"?>'."\r\n";
$this->xml[] = '<DistributionConfig xmlns="">'."\r\n";
$this->xml[] = "\t".'<Origin>'.$bucket.'</Origin>'."\r\n";
$this->xml[] = "\t".'<CallerReference>'.$caller_reference.'</CallerReference>'."\r\n";
$this->xml[] = "\t".'<Enabled>false</Enabled>'."\r\n";
$this->xml[] = '</DistributionConfig>'."\r\n";
$data = implode($this->xml);
mjc / DD32s-combine-plugin.php
Created December 5, 2008 04:38
WIP: Combine Javascript and CSS in wordpress
View DD32s-combine-plugin.php
Plugin Name: The Combiner
Plugin URI:
Description: Combine CSS & JS into one large monolithic file
Author: DD32
Version: 1.0
Author URI:
View gist:36847
Input #0, matroska:
Duration: 00:07:45.01, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 1920x800, 23.98 tb(r)
Stream #0.1(eng): Audio: liba52, 48000 Hz, 5:1, s16
Stream #0.2(eng): Subtitle: 0x0000
View gist:38310
Process: CurseClient [63564]
Path: /Applications/
Identifier: com.yourcompany.CurseClient
Version: ??? (1.0)
Code Type: X86 (Native)
Parent Process: launchd [126]
Date/Time: 2008-12-20 08:08:01.970 -0500
OS Version: Mac OS X 10.5.6 (9G55)
Report Version: 6
View gist:68328
// This software code is made available "AS IS" without warranties of any
// kind. You may copy, display, modify and redistribute the software
// code either by itself or as incorporated into your code; provided that
// you do not remove any proprietary notices. Your use of this software
// code is at your own risk and you waive any claim against Amazon
// Digital Services, Inc. or its affiliates with respect to your use of
// this software code. (c) 2006 Amazon Digital Services, Inc. or its
// affiliates.
mjc / lastfm2itunes.rb
Created April 19, 2009 00:27
lastfm playcounts to itunes script. currently busted
View lastfm2itunes.rb
#!/usr/bin/env ruby
require 'rubygems'
gem 'plist', '>=3.0.0'
gem 'scrobbler', '>=0.2.3'
gem 'hpricot', '>=0.8'
require 'open-uri'
require 'plist'
require 'scrobbler'
require 'hpricot'
# snippet modified from
View gist:131586
//Stephen J. Dickson III
//Michael Cohen
//Mario Muriel
//Computes and displays bank service fees for commercial checking account
#include <iostream>
#include <iomanip>
using namespace std;
View gist:174500
localhost:~ mjc$ DYLD_PRINT_STATISTICS=YES /Applications/
total time: 125.81 milliseconds (100.0%)
total images loaded: 120 (106 from dyld shared cache, 0 needed no fixups)
total segments mapped: 52, into 4715 pages with 655 pages pre-fetched
total images loading time: 35.40 milliseconds (28.1%)
total dtrace DOF registration time: 0.09 milliseconds (0.0%)
total rebase fixups: 150,516
total rebase fixups time: 30.54 milliseconds (24.2%)
total binding fixups: 4,374
total binding symbol lookups: 343, average images searched per symbol: 0.5
View .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
# See the comments below for more info on how to add exceptions for your
View redirect test.php
function tep_redirect($url) {
if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) {
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL