Skip to content

Instantly share code, notes, and snippets.

@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@splittingred
splittingred / .htaccess
Created April 9, 2012 21:48
Example of how to use new REST server class in MODX 2.3+
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ rest/index.php?_rest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ rest/index.php [QSA,NC,L]
</IfModule>
@m-engel
m-engel / MODX ResourceTree Onlysort.php
Last active March 3, 2017 10:25
Disable Drag&Drop Resources out of Containers
// Event: OnManagerPageBeforeRender
$script = "<script>
var ResourceTreeHandleDrop = MODx.tree.Resource.prototype._handleDrop;
Ext.override(MODx.tree.Resource, {
_handleDrop:function(e){
var dropNode = e.dropNode;
var targetParent = e.target;
if(dropNode.getDepth() != targetParent.getDepth() || (e.point == 'append')) return false;
if(dropNode.parentNode.id != targetParent.parentNode.id) return false;
@pepebe
pepebe / ppb_managerBreadCrumbs.plugin.php
Last active August 29, 2015 14:13
The plugin adds a breadcrumb navigation below the pagetitle for easier navigation/orientation.
<?php
/*
ppb_managerBreadCrumbs for modx 2.3.x
Version: 0.1
original plugincode written by @argnisto
frankensteined by info@pepebe.
Description: The plugin adds a breadcrumb navigation below the pagetitle
for easier navigation/orientation.
@tiff
tiff / protonet_rest_api_examples.md
Last active August 29, 2015 14:08
Protonet REST API Examples

Protonet Rest API

All examples in this document are done via curl. You can however use any programming language to access the API. The API expects JSON and responds with JSON.

Authorization

The Protonet REST-API supports two authorization mechanisms:

  1. Basic authorization: Send email and password as base64 encoded string within the request headers
@mkay
mkay / update-modx.sh
Created March 8, 2014 22:57
MODX CLI updater
#!/bin/bash
########################################################
#
# MODX (modx.com) CLI updater
# Kreuder 20140308 mk@s1.gl
#
########################################################
#
# Description: perform a MODX Basic Upgrade via CLI.
#