Skip to content

Instantly share code, notes, and snippets.

View chucktrukk's full-sized avatar

Charlie Madison chucktrukk

View GitHub Profile
@chucktrukk
chucktrukk / Excerpt.php
Created June 2, 2011 21:46 — forked from rthrash/Excerpt.php
A MODx filter for creating smart excerpts of long text passages
/**
* Excerpt
*
* Creates intro excerpts from long passages of text like a Ninja.
*
* @category snippet
* @version 1.0
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @autohor Kevin Marvin, Ryan Thrash
* @internal @modx_category Content
@chucktrukk
chucktrukk / remove-slashes.php
Created June 2, 2011 21:43
remove double slashes from modx output
<?php
$output = $this->modx->documentOutput;
$pattern = '/<a[^>]*>/';
preg_match_all($pattern, $output, $matches);
$matches = array_pop($matches);
$replace = array();
foreach($matches as $key => $match) {
select a.*
from Trucks t
inner join Boxes b on t.id = b.truck_id
inner join Apples a on b.id = a.box_id
where t.owner_id = 34
/*
Makes sense. From http://oppugn.us/posts/1287608776.html
*/
body {
width: 960px;
margin-left: auto;
margin-right: auto;
}
function getLinkscape() {
lastRow = FindRows();
startRow = lastRow + 1;
var active_spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var utility_sheet = active_spreadsheet.getSheetByName("Utilities");
params = utility_sheet.getRange(5,3,7,3).getValues();
url = params[2][0];
AccessID = params[0][0];
secret = params[1][0];
method = "HMAC_SHA_1";
@chucktrukk
chucktrukk / gist:936717
Created April 22, 2011 14:08
jquery.quickpaginate.js
jQuery.fn.quickpaginate = function (settings) {
settings = jQuery.extend({
perpage: 6,
pager: null,
showcounter: true,
prev: "qp_next",
next: "qp_prev",
pagenumber: "qp_pagenumber",
totalnumber: "qp_totalnumber",
counter: "qp_counter"
$failedDays = floor((strtotime("now") - strtotime($subscription->transaction_date)) / (60 * 60 * 24));
if (date("Y-m-d",strtotime("now")) == date("Y-m-d", strtotime($subscription->end_date))) {
if (($failedDays % $billingReminderFrequencyInDays) == 0) {
if (in_array(date("j"),$updatePaymentMethodReminderDaysOfTheMonth)) {
<?php
// &file=`assets/foo/bar.php` indicates the file to include
// &return=`1` return explicit content from return statement in included file
// default behavior is to use output buffering to capture the content from the include
$output = '';
if (isset($file) && file_exists($modx->config['base_path'] . $file)) {
if (!isset($return) || $return == false) {
ob_start();
include ($modx->config['base_path'] . $file);
Workflow
Who can Publish
- list groups (if checked, checks all users below)
- list users
Allowed Status'
- list status here [raw, for editor, for publisher]
"Raw" Status
[ { "desc" : "Use the default parameter to have this Snippet redirect to the Resource specified in cases where there is no children. It can be a Resource ID or one of : site_start, site_unavailable_page, error_page, unauthorized_page.",
"desc_trans" : "Use the default parameter to have this Snippet redirect to the Resource specified in cases where there is no children. It can be a Resource ID or one of : site_start, site_unavailable_page, error_page, unauthorized_page.",
"lexicon" : null,
"menu" : null,
"name" : "default",
"options" : "",
"overridden" : false,
"value" : "site_start",
"xtype" : "textfield"
},