Skip to content

Instantly share code, notes, and snippets.

@pepebe
pepebe / listLocales.php
Created August 9, 2021 14:47 — forked from Azeirah/listLocales.php
List supported locales
<?php
// this list is large, but might not be completely exhaustive.
// I retrieved it from this stackoverflow answer: http://stackoverflow.com/a/20818686/2302759
// and added zh_TW
$locales = ["af_NA", "af_ZA", "af", "ak_GH", "ak", "sq_AL", "sq", "am_ET", "am", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SD", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "ar", "hy_AM", "hy", "as_IN", "as", "asa_TZ", "asa", "az_Cyrl", "az_Cyrl_AZ", "az_Latn", "az_Latn_AZ", "az", "bm_ML", "bm", "eu_ES", "eu", "be_BY", "be", "bem_ZM", "bem", "bez_TZ", "bez", "bn_BD", "bn_IN", "bn", "bs_BA", "bs", "bg_BG", "bg", "my_MM", "my", "ca_ES", "ca", "tzm_Latn", "tzm_Latn_MA", "tzm", "chr_US", "chr", "cgg_UG", "cgg", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zh", "kw_GB", "kw", "hr_HR", "hr", "cs_CZ", "cs", "da_DK", "da", "nl_BE", "nl_NL", "nl", "ebu_KE", "ebu", "en_AS", "en_AU", "en_BE", "en_BZ", "en_
@pepebe
pepebe / curl-verbose.php
Created January 13, 2020 15:06 — forked from hubgit/curl-verbose.php
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);
@pepebe
pepebe / MODX index.php
Created July 18, 2019 14:02 — forked from christianseel/MODX index.php
MODX index.php with XRouting integrated
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@pepebe
pepebe / xpdo-where
Created July 18, 2019 12:38 — forked from davidpede/xpdo-where
pdoResources where examples
&where=`{ "template:IN" : [ 1,2,3 ] }
&where=`{ "template:NOT IN" : [ 1,2,3 ] }
&where=`[{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}]`
@pepebe
pepebe / syncpage.php
Created June 17, 2019 14:05 — forked from krismas/syncpage.php
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
@pepebe
pepebe / box-shadow.html
Created February 1, 2019 08:45 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@pepebe
pepebe / getFormSteps.php
Created December 5, 2018 15:11 — forked from jonleverrier/getFormSteps.snippet.php
getFormSteps for the MODX Formalicious form builder by Sterc. This utility snippet displays all the step titles for a given form ID.
<?php
/*
getFormSteps snippet
for the Formalicious form builder for MODX by Sterc
This utility snippet displays all the step titles for a given form ID
Put the snippet in the Formalcious steps tpl and call like this;
[[!getFormSteps? stepFormId=`[[!+form_id]]` &tpl=`myFormStepsTpl`]]
@pepebe
pepebe / collections.imageplus.js
Created September 16, 2018 10:36 — forked from jenswittmann/collections.imageplus.js
Custom MODX Collections renderer for Image+ with cropping
collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) {
if (value != '' && value != null) {
var data = Ext.decode(value);
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1';
var params = {};
params.src = 'upload/'+MODx.config['collections.renderer_image_path'] + data.sourceImg.src;
params.w = 100;
if (data.sourceImg.src.indexOf('.png') !== -1) {
params.f = 'png';
@pepebe
pepebe / Messages
Created May 12, 2017 21:19 — forked from sottwell/Messages
Dashboard Widget to display the number of internal Manager messages the user has - MODX Revoluition
// Dashboard widget to show number of Manager messages
$id = $modx->user->get('id');
$output = 'No messages.';
$total = $modx->getCount('modUserMessage',array(
'recipient' => $id,
));
if($total) {
$output = 'You have ' . $total . ' messages';
$unread = $modx->getCount('modUserMessage',array(
'recipient' => $id,
@pepebe
pepebe / Chunk tabNavigationItem
Last active June 6, 2019 10:41 — forked from christianseel/Chunk tabNavigationItem
"generateTabs" output (Bootstrap 3.x) filter for ContentBlocks. See http://sedadigital.slides.com/sedadigital/contentblocks2#/4/6 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>