Skip to content

Instantly share code, notes, and snippets.

@digibutt
digibutt / gist:1798328
Created February 11, 2012 09:49
xtype
{
xtype: "textfield"
,fieldLabel: "Name of Sloth"
,name: "name"
,required: true
}
@digibutt
digibutt / gist:1798254
Created February 11, 2012 09:32
Sloth in a box
var form = new Ext.form.FormPanel({
layout: 'form'
,title: "Sloth in a box ltd. <em>Sloth Inventory Management System 2.0</em>"
,labelWidth: 200
,labelPad: 20
,labelAlign: 'right'
,bodyStyle: {
padding: '20px 0'
}
,items: [
@digibutt
digibutt / gist:1798053
Created February 11, 2012 08:53
Hello World Ext Combo
Ext.onReady(function(){
var helloWorld = new Ext.form.Label({
text: 'Pick a country to say Hello to!'
,renderTo: 'page'
});
var dropdown = new Ext.form.ComboBox({
store: new Ext.data.ArrayStore({
id: 0,
fields: [
@digibutt
digibutt / gist:1797766
Created February 11, 2012 08:17
Ext JS Hello World!
Ext.onReady(function(){
var helloWorldHongKongStyle = new Ext.form.Label({
text: 'Ni Hao Shi Jie!'
,renderTo: 'page'
});
});
@digibutt
digibutt / gist:1797756
Created February 11, 2012 08:05
Hello World jQuery
$(document).ready(function(){
$('#page').text("Ni Hao Shi Jie!");
});
@digibutt
digibutt / gist:1797749
Created February 11, 2012 08:01
Hello World JS
var element = document.getElementById('page');
element.innerHTML = 'Ni Hao Shi Jie!';
@digibutt
digibutt / gist:1797680
Created February 11, 2012 07:56
Basic HTML markup
<!doctype html>
<head>
</head>
<body>
<div id="page"></div>
</body>
@digibutt
digibutt / gist:1302987
Created October 21, 2011 02:45
getResourceAsPlaceholder
<?php
/*
Call it like this:
[[getResourceAsPlaceholder?
&id=`10`
&prefix=`doc.`
&separator=`.`
@digibutt
digibutt / gist:1269576
Created October 7, 2011 06:08
htaccess
# MODX supports Friendly URLs via this .htaccess file. You must serve web
# pages via Apache with mod_rewrite to use this functionality, and you must
# change the file name from ht.access to .htaccess.
#
# Make sure RewriteBase points to the directory where you installed MODX.
# E.g., "/modx" if your installation is in a "modx" subdirectory.
#
# You may choose to make your URLs non-case-sensitive by adding a NC directive
# to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
@digibutt
digibutt / gist:1228932
Created September 20, 2011 11:55
Log a hit in a plugin in MODX
$tv = $modx->getObject('modTemplateVar', array('name' => 'hitcount'));
$criteria = array(
'tmplvarid' => $tv->get('id'),
'contentid' => $modx->resourceIdentifier
);
if(!$tvResource = $modx->getObject('modTemplateVarResource', $criteria)){
$tvResource = $modx->newObject('modTemplateVarResource');
$tvResource->set('value', 1);