Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* An extension to modUser that allows Atlassian Crowd integration via SOAP.
*
* @todo Complete this class to handle all external user management tasks
* allowed with Crowd.
*
* @package modx
* @subpackage user.crowd
*/
<?php
$output = array();
$total = 0;
$limit = isset($limit) ? (integer) $limit : 0;
$offset = isset($offset) ? (integer) $offset : 0;
$totalVar = !empty($totalVar) ? $totalVar : 'total';
// determine the total number of records for your criteria
$totalStmt = $modx->query("SELECT COUNT(*) FROM `myTable` WHERE `food` = 'beer'");
<?php
$output = '';
$tElementClass = !empty($tElementClass) ? $tElementClass : 'modSnippet';
$tStart = $modx->getMicroTime();
if (!empty($tElement)) {
switch ($tElementClass) {
case 'modChunk':
$output = $modx->getChunk($tElement, $scriptProperties);
break;
@rthrash
rthrash / Excerpt.php
Created October 6, 2010 23:26
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
[[!getPage?
&element=`getResourcesTag`
&elementClass=`modSnippet`
&tpl=`pitem_home`
&hideContainers=`1`
&pageVarKey=`page`
&parents=`[[*id]]`
&includeTVs=`1`
&includeContent=`1`
&pageFirstTpl=`&nbsp;`
@opengeek
opengeek / getCache.sample.html
Created October 16, 2010 05:00
Snippet to flexibly cache any modElement instance
<div>
<ul>
[[!getCache? &element=`getResources` &elementClass=`modSnippet` &cache_expires=`1200` &parents=`0` &depth=`0` &limit=`2` &tpl=`ulTpl` &sortby=`RAND()`]]
</ul>
</div>
/*
* This is a modified version of the ck editor integration from the public
* domain source in http://www.sencha.com/forum/showthread.php?79031.
*
* Fixed issues when loading multiple editors in multiple TabPanels, wrong calls
* to the superclass methods.
*/
Ext.namespace("Ext.ux.form");
echo '
' . "\n\n";
set_time_limit( 100 );
$time = microtime();
$time = explode(' ', $time);
global $modx;
$doc = $modx->getDocument($id);
$output = '';
if(!empty($doc))
$output = "<a title='".$doc[' pagetitle']."' href='".$modx->makeUrl($id, '', '',
'full')."'>".$doc['pagetitle']."</a>";

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables