Skip to content

Instantly share code, notes, and snippets.

View chucktrukk's full-sized avatar

Charlie Madison chucktrukk

View GitHub Profile
<?php
function buildHierarchy(&$results, $parent = 0, $level = 0)
{
global $modx;
$children = array_values($modx->getChildIds($parent, 1));
$level = $level + 1;
foreach($children as $child)
{
$descendents = array_values($modx->getChildIds($child, 100));
<?php
// Use with OnLoadWebDocument
// Checks if in an Ajax call is made by checking if the value in X-Requested-With is given in the header.
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
$modx->documentContent = '[*content*]';
}
?>
source ~/bin/aliases
source ~/bin/gitprompt
export PATH="/usr/local/bin:~/bin:$PATH"
export SVN_EDITOR="mate -w"
export GIT_EDITOR="mate -w"
/*
From: http://github.com/M4N14C/StoopidCMS/blob/master/public/javascripts/facebooker.js
*/
function $(element) {
if (typeof element == "string") {
element=document.getElementById(element);
}
if (element)
extend_instance(element,Element);
return element;
/*
* SWFUpload jQuery Plugin v1.0.0
*
* Copyright (c) 2009 Adam Royle
* Licensed under the MIT license.
*
*/
(function($){
<?php
function GetDocumentData() {
$Database = $this->modx->db;
$DocIDs = $this->modx->getChildIds($this->Configuration['StartID'], $this->Configuration['Level']);
$Select = array(
'ID' => 'sc.id',
'Parent' => 'sc.parent',
'Hidden' => 'sc.hidemenu',
<?php
// Specifically for foxycart -> modx
// Add 1 day (86400 seconds) to the transaction date.
date('U', strtotime($order['order']['next_transaction_date']) + 86400)
==Steps
1. Add remote
2. Fetch remote
2. checkout new branch at new remote
3. switch to master
4. read tree into new folder
==Example
git remote add REPO_remote [email protected]:schacon/rack.git
git fetch REPO_remote
<?php
//File: osc/includes/password_funcs.php
/*
$Id: password_funcs.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function(){
// Set the indexes for the countries you want to allow
var usIndex = -1;
var caIndex = -1;
// Find their positions in the array using the 2 character ISO code
for (var i = 0; i < FC.locations.config.locations.length; i++) {
if (FC.locations.config.locations[ i ].cc2 == "US") {
usIndex = i;
} else if (FC.locations.config.locations[ i ].cc2 == "CA") {