Skip to content

Instantly share code, notes, and snippets.

View lithiumlab's full-sized avatar

Pablo Liz lithiumlab

View GitHub Profile
@rmorse
rmorse / sf-pro-filter-input-object.php
Last active February 6, 2024 23:01
Search & Filter Pro - Filter Input Object
<?php
function filter_input_object($input_object, $sfid)
{
//ensure we are only filtering the correct field name - in this case the field we want to filter has the name `_sfm_colours`
//we also want to make sure its a `select` input type we're filtering
if(($input_object['name']!='_sfm_colours')||($input_object['type']!='select'))
{
return $input_object;
}
@scottopolis
scottopolis / wp-api-cpt.php
Last active June 23, 2017 19:23
Add multiple custom post types to the WP-API
<?php
// This is a temporary solution until register_post_type_args is available
// After adding your CPT, you can find it at mysite.com/wp-json/wp/v2/[slug]
function sb_add_cpts_to_api() {
global $wp_post_types;
// Add CPT slugs here
$arr = ['fake','movie','books'];
@cameron
cameron / docker-ssl-cert-generate
Last active February 2, 2023 10:09
Generate self-signed SSL certs for docker client <— HTTPS —> daemon
#! /bin/bash
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem
openssl genrsa -des3 -out server-key.pem
openssl req -new -key server-key.pem -out server.csr
@TomByrne
TomByrne / MultiExporter.jsx
Last active June 14, 2024 09:48
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@jmaddington
jmaddington / modx-json-to-placeholders
Last active September 17, 2022 02:49
Quick snippet to set placeholders from a JSON array. Made basically so I could create MIGXs inside MIGXS. There is little error checking are anything else at this point. Use at your own risk.
<?php
/**
* jsonToPlaceholders snippet for JM Customer Database extra
*
* Copyright 2013 by JM Addington jm@jmaddington.com
* Created on 04-28-2013
*
* @package jmc
*/
@Scarygami
Scarygami / app.yaml
Created April 25, 2013 13:16
Handling multipart/related or multipart/mixed requests, comparable to mediaupload requests of some Google APIs (https://developers.google.com/glass/media-upload#multipart), using webapp2 and the email library on App Engine
application: upload-test
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: .*
script: main.app