Skip to content

Instantly share code, notes, and snippets.

View zaigham's full-sized avatar
🌏

Zaigham R. zaigham

🌏
View GitHub Profile
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@larscwallin
larscwallin / README.txt
Created November 17, 2011 11:32
SIMPLX Widgeteer 0.8.5
SIMPLX Widgeteer 0.8.5
UPDATE 120117 10:04
Fixed a bug in the templateNSPlaceholder method thanks to Keith Baker :)
NEW FEAUTURES
If you use namespaced placeholders, you can now reference the first object in any list (array). This was not possible
before. This is going to be even easier later on as you are going to be able to query for objects using regex etc.
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@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>
@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
@matthewlehner
matthewlehner / autopgsqlbackup
Created July 11, 2012 16:10
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@krismas
krismas / syncpage.php
Last active October 14, 2021 14:03
A small MODX plugin to avoid refreshing - by default - the entire site cache when editing a resource
<?php
/*
* A small MODX plugin to avoid refreshing - by default - the entire site cache when editing a cached resource - (c) 2012 ackwa.fr
*
* @version : 1.0.0
* @see : https://gist.github.com/gists/3639503
* @name : syncpage.php
* @author : g.noel@ackwa.fr
*
* @event : OnDocFormSave, OnDocFormPrerender
@opengeek
opengeek / optimized.html
Created September 18, 2012 17:08
Example of optimizing conditional filters using a Chunk wrapper
[[[[*page-image:notempty=`$wrapImgThumb? &src=`*page-image` &alt=`[[*pagetitle]]` &thumbOpts=`w=480&h=320``]]]]
@netProphET
netProphET / babelContextRouter.plugin.php
Last active October 19, 2023 07:08
MODX Cloud web rules example for Babel with two languages.In this example, German is the default language with resources in the 'web' context; English is the secondary language, set up in the 'en' context.This technique is based on the "SEO Friendly Multilingual Websites" article archived here: https://web.archive.org/web/20180927220103/http://w…
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'en':
/* switch the context */
$modx->switchContext('en');
break;
default:
/* Set the default context here */
@pepebe
pepebe / debug2chunk
Created July 23, 2013 10:32
Write formit values into a debug chunk
<?php
/*
* Write formit values into a debug chunk
* basic idea by bruno17
* Be careful with the append parameter. If your script continues to
* write into the debug chunk, You'll get a GIGANTIC file that
* can cause a wsod (white screen of death) without any hint to the real cause...
*/
$append = false;