Skip to content

Instantly share code, notes, and snippets.

@em-piguet
em-piguet / datefr.php
Created November 23, 2012 14:15
Met la date en fr (output modifier)
<?php
// Snippet : DATEFR
// Usage: [[+tv.datedebut:strtotime:DATEFR]]
//
setlocale(LC_ALL, 'fr_FR.UTF-8');
$output = strftime('%e %B %Y',strtotime($input));
return $output;
<?php
/**
 * lanstrip snippet to output different languages, e.g. in Gallery templates.
 * The snippet displays the text matching the current "cultureKey".
 * Can be used anywhere - in chunks, templates etc.
 * The default text must be written first, without a preceeding "#" - this text is used if no matching cultureKey is found.
 * To make the Gallery snippet display a text in different languages, the editor enters the album title like this:
 * "Blå båt #en Blue boat #de Blau Boot"
 * In the gallery item chunk the snippet is called like this:
 * [[lanstrip? &text=`[[+name]]`]]

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@em-piguet
em-piguet / createResource.php
Last active November 21, 2015 17:12
Create MODX Resources with a Loop
<?php
/*
* CreateResource MODX API
* http://forums.modx.com/thread/82642/how-would-i-create-a-new-resource-via-the-api#dis-post-456111
*/
$i='';
for($i==0; $i<=100; $i++){
@em-piguet
em-piguet / README.md
Last active February 2, 2019 13:02
Minimal Portfolio with MODX and Isotope.js
@em-piguet
em-piguet / sample.htaccess
Last active September 22, 2022 18:16
Add this in your .htaccess to get a better note on gtmetrix :)
# Make sure .htc files are served with the proper MIME type, which is critical
# for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
AddType text/x-component .htc
# If your server is not already configured as such, the following directive
# should be uncommented in order to set PHP's register_globals option to OFF.
# This closes a major security hole that is abused by most XSS (cross-site
@em-piguet
em-piguet / Replace SVG to inline SVG
Last active August 29, 2015 14:04
Replace all SVG images with inline SVG. Very useful if you need to use CSS on SVG
/*
* Replace all SVG images with inline SVG
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
jQuery.get(imgURL, function(data) {
@em-piguet
em-piguet / 0_reuse_code.js
Created July 22, 2014 12:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@em-piguet
em-piguet / changeTemplate.php
Last active August 29, 2015 14:13
changeTemplate (batch resources)
/*
[[changeTemplate &parent=`ID` &template=`ID`]]
*/
foreach ($modx->getIterator('modResource', array('parent' =>$parent)) as $res) {
$res->set('template',$template);
$res->save();
echo ('Mise à jour du template OK <br/>');
}