Skip to content

Instantly share code, notes, and snippets.

@lawebfabric
lawebfabric / randomChunk.php
Last active December 1, 2018 15:30
This snippet will return chunks in a random order.
<?php
//-----------------------------------------------------------
// randomChunk
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*
* Created on: 08/10/18
@lawebfabric
lawebfabric / changing-tab-title.js
Created October 11, 2018 15:38
Jquery function to change browser tab title when browser tab is not active
jQuery(document).ready(function( $ ){
// Get page title
var pageTitle = $("title").text();
// Change page title on blur
$(window).on('blur', function() {
$("title").text('💔 Vous nous manquez !');
});
@lawebfabric
lawebfabric / copyrightYear.php
Last active December 1, 2018 15:30
Copyright Year Snippet for MODX Revolution
<?php
//-----------------------------------------------------------
// copyrightYear
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
// Usage : [[copyrightYear? &since=`2010`]] or with only the current year [[copyrightYear]]
@lawebfabric
lawebfabric / formatPhone.php
Last active December 1, 2018 15:29
A simple snippet that return formated phone number for a html tag
<?php
//-----------------------------------------------------------
// formatPhone
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
// $input = '04 94 39 28 49';
@lawebfabric
lawebfabric / noaccents.php
Last active December 1, 2018 15:29
Simple (output modifier) snippet to replace accent caracters with caracters whithout accent
<?php
//-----------------------------------------------------------
// noaccents
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
/*
@lawebfabric
lawebfabric / emailPrefix.php
Last active December 1, 2018 15:28
email obfuscator for MODX
<?php
//-----------------------------------------------------------
// emailPrefix
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
/*
@lawebfabric
lawebfabric / collections.customrenderer.js
Last active February 8, 2019 16:34
Custom image & imagePlus render for MODX Collection Extra
//-----------------------------------------------------------
// Collections Customrenderer
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
*/
// ------------------------------
@lawebfabric
lawebfabric / fbPageGraph.php
Last active December 1, 2018 15:51
MODX Snippet facebook Page Graph using API
<?php
//-----------------------------------------------------------
// fbPageGraph
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
* @description: Returns the number of fans for a facebook fanpage (via the graph api)
* @version 1.0.0 - 2018-11-22
@lawebfabric
lawebfabric / getDate.php
Last active December 1, 2018 16:00
Show or Hide Content, Chunk or Whatever you want in MODX easily
<?php
//-----------------------------------------------------------
// getDate
//-----------------------------------------------------------
/*
* @author: Steeve from lawebfabric
* @website: http://www.lawebfabric.com
* @tutorial modx website: http://www.tutocms.fr/
* EXAMPLE USAGE
* [[!getDate:strtotime:date=`%y%m%d`:toPlaceholder=`now`]] date = YearMonthDay
@lawebfabric
lawebfabric / dump.php
Last active March 21, 2019 18:32
mysql dump php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
$dir = dirname(__FILE__) . '/dump.sql';
echo "<h3>Backing up database to `<code>{$dir}</code>`</h3>";