Skip to content

Instantly share code, notes, and snippets.

View oksushi's full-sized avatar

Cal Wilson oksushi

View GitHub Profile
@oksushi
oksushi / migx_modx-2.2.diff
Created October 6, 2011 04:43 — forked from netProphET/migx_modx-2.2.diff
MIGX diff for MODX2.2
--------------- core/components/migx/elements/tv/input/migx.php ---------------
index 11a9c2d..53370a5 100644
@@ -133,6 +133,7 @@ $lang = $this->xpdo->lexicon->fetch();
$lang['mig_add'] = !empty($properties['btntext'])?$properties['btntext']:$lang['mig_add'];
$modx->smarty->assign('i18n', $lang);
$this->xpdo->smarty->assign('properties', $properties);
+$this->xpdo->smarty->assign('resource', is_object($this->xpdo->resource) ? $this->xpdo->resource->toArray() : array());
$this->xpdo->smarty->assign('pathconfigs', $this->xpdo->toJSON($pathconfigs));
$this->xpdo->smarty->assign('columns', $this->xpdo->toJSON($cols));
$this->xpdo->smarty->assign('fields', $this->xpdo->toJSON($fields));
@oksushi
oksushi / MODCreateSubdocs
Created October 14, 2011 02:40
MODX: Plugin to create sub document on save - apply OnDocFormSave
<?php
if ($mode == 'new') {
$new = $modx->newObject('modDocument');
$new->set('parent',$id);
$new->set('pagetitle','My New Pagetitle');
$new->save();
}
@oksushi
oksushi / fixAlias
Created October 29, 2011 03:34
If you forget to set the alias with bulk-created resources in MODX, this will help you adjust them
<?php
//
// Create Alias
// Receives a template and a new alias and will adjust the alias of each of those docs
$template = $modx->getOption('template',$scriptProperties,'1');
$newAlias = $modx->getOption('alias',$scriptProperties,'1');
$changeddocs = $modx->getCollection('modResource',array(
'template' => $template
));
foreach($changeddocs as $thisdoc){
@oksushi
oksushi / gist:3021999
Created June 30, 2012 03:14 — forked from chrisjoyce/gist:1177888
Stylus conversion of Normalize.css
/*
* Normalize.css converted to Stylus
* http://github.com/necolas/normalize.css
*/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section
display: block
audio, canvas, video
display: inline-block
@oksushi
oksushi / dabblet.css
Created July 18, 2012 22:17
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
#outer {background: lime;}
#container {
width: 960px;
height: 100px;
background: hotpink;
margin: auto;
@oksushi
oksushi / dabblet.css
Created July 20, 2012 01:17
transitioning Opacity in CSS
/**
* transitioning Opacity in CSS
*/
div {background: url(http://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Chihuahua_puppy_001.jpg/220px-Chihuahua_puppy_001.jpg) center no-repeat;
width: 100px;
height: 220px;
transition:opacity 500ms cubic-bezier(0.250, 0.250, 0.750, 0.750)
}
div:hover {
opacity: .1;
@oksushi
oksushi / dabblet.css
Created July 21, 2012 00:44
Displaying the :contains selector
/**
* Displaying the :contains selector
*/
div:contains("lorem") {
background: hotpink;
}
@oksushi
oksushi / dabblet.css
Created July 23, 2012 03:32
Displaying the :contains selector
/**
* Displaying the :contains selector
*/
div {
position: relative;
border: 1px solid black;
}
label {
position: absolute;
width: 5px;
@oksushi
oksushi / dabblet.css
Created July 23, 2012 23:38
Displaying the :contains selector
/**
* Displaying the :contains selector
*/
[href="/about"] {
background: url(https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Info_icon_001.svg/400px-Info_icon_001.svg.png) left center no-repeat;
display: block;
padding-left: 2em;
background-size: 1em;
}
@oksushi
oksushi / dabblet.css
Created July 24, 2012 00:42
Table with varying widths
/**
* Table with varying widths
*/
table {
width: 100%;
border: 1px solid hotpink;
border-collapse: collapse;
table-layout: fixed;
border-spacing: 1em;
}