Skip to content

Instantly share code, notes, and snippets.

View pixelchutes's full-sized avatar
👋

Mike Reid pixelchutes

👋
View GitHub Profile
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@MacConin
MacConin / pdoMenu test pattern
Created March 9, 2015 10:03
pdoMenu test pattern Curious which templates needed for your modx menu? Just place this snippet call into your layout Replace placeholder (A-K and 1-10) with needed functions.
<!-- Testpattern for pdoMenu -->
[[pdoMenu?
&parents = `0`
&level = `2`
&cache=`0`
&tplOuter = `@INLINE <ul[[+classes]]>
@koelling
koelling / gist:ef9b2b9d0be6d6dbab63
Last active February 7, 2017 16:21
CVE-2015-0235 (GHOST) test code
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
@jaygilmore
jaygilmore / sectionNav.html
Created May 13, 2014 15:23
Nested getResources Calls from RTFM
[[getResources@section-nav? &parents=`[[+id]]` &level=`[[+level:add]]` &toPlaceholder=`childNav`]]
<li>
[[+childNav:notempty=`<i class="icon-caret-right"></i>`]]
<a href="[[~[[+id]]]]">[[+menutitle:default=`[[+pagetitle]]`]]</a>
[[+childNav]]
</li>
@enminc
enminc / putMethodsInYourClass .php
Last active August 29, 2015 14:00
modx.getSnippet
<?php
/**
* Similar in practice to localizing getChunk and _getChunkTpl
* in your class to pull chunks from disk but for snippet code
*/
class putMethodsInYourClass {
/**
@svrl
svrl / nginx-php-fpm-homebrew-10.9.md
Created November 7, 2013 06:57
Installing NGINX and PHP-FPM on OS X 10.9 with Homebrew

OS X 10.9 - Nginx, php commands

Installing PHP 5.5 (with FPM) on Mac OS X

Search for available PHP formulas (formula’s in homebrews are equivalent to packages in aptitude)

brew search php

It will return long list of php 5.2, 5.3, 5.4, 5.5 packages. We need 5.5. Tap it using:

@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@splittingred
splittingred / gist:4689218
Last active April 30, 2019 09:39
Example of modRest, a REST Client, in MODX 2.3.
$config = array(
'baseUrl' => rtrim('http://mywebsite.com/rest/api/','/'),
'format' => 'json', // json or xml, the format to request
'suppressSuffix' => false, // if false, will append .json or .xml to the URI requested
'username' => 'myuser', // if set, will use cURL auth to authenticate user
'password' => 'mypass',
'curlOptions' => array(
'timeout' => 30, // cURL timeout
'otherCurlOption' => 1,
@Mark-H
Mark-H / a readme.md
Last active November 24, 2022 13:16
modCli; using MODX on the commandline.

modCLI

modCLI is a wrapper for the MODX Revolution Processors, allowing you to pretty much do anything from the commandline that you would normally do within the manager.

To use modCLI, simply download the modcli.php file and put it in the MODX_BASE_PATH of your installation. Next open up the console or terminal, and start firing some commands at it.

Syntax

@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``]]]]