Skip to content

Instantly share code, notes, and snippets.

View davidpede's full-sized avatar

David Pede davidpede

View GitHub Profile
@davidpede
davidpede / xpdo-where
Last active October 11, 2023 20:49
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"}]`
[[pdoResources?
&parents=`537`
&limit=`0`
&showHidden=`0`
&hideContainers=`1`
&sortby=`longtitle`
&sortdir=`ASC`
&tplWrapper=`@INLINE N/A==na||[[+output]]`
&tpl=`@INLINE [[+longtitle]]==[[+id]]||`
&tplLast=`@INLINE [[+longtitle]]==[[+id]]`
<div style="absolute;top:0;left:0;width:100%">
[^qt^] - Query Time - Shows how long MODx took talking to the database<br/>
[^q^] - Query Count -Shows how many database queries MODx made<br/>
[^p^] - Parse Time - Shows how long MODx took to parse the page<br/>
[^t^] - Total Time - Shows the total time taken to parse/ render the page<br/>
[^s^] - Source - Shows the source of page, whether is database or cache.
</div>
<!-- MySQL: [^qt^], [^q^] request(s), PHP: [^p^], Total: [^t^], document retrieved from [^s^]. -->
@davidpede
davidpede / Clear Field on Focus
Last active August 29, 2015 13:56
Clear the content of a text input field when on focus
# Option One
<script type="text/javascript">
$(document).ready(function() {
$("input:text").each(function () {
var v = this.value; // store default value
$(this).blur(function () {
if (this.value.length == 0) this.value = v; // if input is empty, reset value to default
})
.focus(function () {
this.value = ""; // when input is focused, clear its contents
@davidpede
davidpede / mp4Box - Apple iOS Subtitles
Last active August 29, 2015 13:56
Commands for muxing Apple iOS compatible soft subtiles into MP4 files using mp4Box
# Add subtitle track
-add "input.mp4" -add "english-subs.srt:hdlr=sbtl:group=2:layer=-1:lang=en:name=English" -new "output.mp4"
# Add multiple subtitle tracks
-add "input.mp4" -add "english-subs.srt:hdlr=sbtl:group=2:layer=-1:lang=en:name=English" -add "french-subs.srt:hdlr=sbtl:group=2:layer=-1:lang=fr:disabled:name=French" -new "output.mp4"