Skip to content

Instantly share code, notes, and snippets.

@FuzzicalLogic
FuzzicalLogic / OnBinaryResourceLoad
Created March 16, 2015 13:01
Sample MODX Revolution Plugin for Binary Resources
<?php
if ($modx->event->name == 'OnLoadWebDocument'
&& $modx->resource->get('type') == 'document') {
$mime = $modx->resource->get('contentType');
$isBinary = $modx->getObject('modContentType', array('mime_type' => $mime))->get('binary');
if ($isBinary == 1) {
$bytes = base64_decode($modx->resource->get('content'));
}
@pepebe
pepebe / getTVLabel.snippet.php
Last active September 9, 2015 08:26
Proof of concept for toggling tv groups with a select TV in MODX.
<?php
/*
getTVLabel snippet for modx 2.3
Version:
------------------
v0.0.1 (2015-03-06 16:44)
Author:
------------------
@olange
olange / graphviz-build-system-for-sublime.md
Created January 4, 2015 00:21
Graphviz (DOT) Build System for Sublime Text 2 and 3

To transform the currently opened Graphviz source file (in DOT Language) into a PNG:

{
    "cmd": [ "dot", "-Tpng", "-o", "$file_base_name.png", "$file"],
    "selector": "source.dot"
}

Usage

@christianseel
christianseel / Chunk tabNavigationItem
Last active November 8, 2023 11:47
"generateTabs" output filter for ContentBlocks. See http://slides.com/christianseel/contentblocks/ for instructions.
<li class="tab-title [[+idx:is=`1`:then=`active`:else=``]]" role="presentational">
<a href="#[[+id]]" role="tab" tabindex="0" aria-selected="false" controls="[[+id]]">[[+title]]</a>
</li>
@DESIGNfromWITHIN
DESIGNfromWITHIN / Gulpfile.js
Created June 27, 2014 07:56
MODX Gulp, SASS, NEAT & Browser-Sync build file
var gulp = require('gulp');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var minifycss = require('gulp-minify-css');
var concat = require('gulp-concat');
var neat = require('node-neat').includePaths;
var browserSync = require('browser-sync');
var paths = {
@pepebe
pepebe / gist:11168024
Created April 22, 2014 07:04 — forked from jpdevries/gist:5516772
Use phpthumbof in a cmp
$modAuth = $this->modx->user->getUserToken('mgr');
$thumbQuery = http_build_query(array(
'src' => $image['urlAbsolute'],
'w' => 360,
'h' => 270,
'HTTP_MODAUTH' => $modAuth,
//'f' => $thumbnailType,
'q' => 80,
'wctx' => 'mgr',
@marcjenkins
marcjenkins / .gitignore
Created April 17, 2014 17:36
.gitignore for MODX projects
# ignore everything in this directory
/*
# but not these
!.gitignore
!assets/
!core/
!_SASS/
!_JS/
@pepebe
pepebe / hideTVs.plugin.php
Created April 15, 2014 13:06
Hide TVs from root resources in MODX Manager
<?php
/**
* Hide TVs for root elements...
*/
/* Set option(s) here */
$tvs_to_hide = '1,2';
/* ---------------------------------- */
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>