Skip to content

Instantly share code, notes, and snippets.

View millipedia's full-sized avatar

millipedia millipedia

View GitHub Profile
@millipedia
millipedia / pw_ploi_nginx
Last active November 25, 2025 14:47
nginx conf tweaks for PW on Ploi
########## begin custom config
# mostly from jacmaes setup in the PW forum.
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires 48h;
access_log off;
try_files $uri $uri/ /index.php?it=$uri&$args;
}
@millipedia
millipedia / import_example.php
Created September 10, 2021 11:47
Processwire example import scrip
<?php namespace ProcessWire;
/**
*
* Import images from a CSV from WP (or wherever).
* In this case CSV has image path and page alias.
*
*/
include("index.php");
@millipedia
millipedia / calculate_reading_time.php
Last active December 20, 2021 12:23
Processwire hook to calculate article reading time
<?php
/**
*
* Calculate reading time on page save.
* Add this to your ready.php file.
* Uses a field called 'article_read_time' to store the value
* and the field 'page_content' as the readable content.
* You'll need to update those field names if yours are different.
*
@millipedia
millipedia / check_links.php
Created September 10, 2021 10:13
Display the http response of a list of URLs in a CSV
@millipedia
millipedia / user_import.php
Created November 5, 2020 10:31
ProcessWire user import
<?php namespace ProcessWire;
/**
* 201105
*
* Quick script to read in a CSV of users and create
* users in ProcessWire's LoginRegisterPro module.
* Place this in the root of your PW install and then open /user_import.php
* Yeah - sure it could be done in a shell script or in Tracy but this is
* pretty simple.
@millipedia
millipedia / generate-app-icons.sh
Last active May 26, 2016 16:22 — forked from dknell/generate-app-icons.sh
This script will generate all iOS and Android icon files (including retina) using the built-in sips command in OS X. It will also compress the PNGs if ImageOptim is installed. This is based off another awesome Gist found here: https://gist.github.com/jessedc/837916
#!/bin/bash
COMPRESS=1 # Compress if ImageOptim is intalled. 0 = disabled; 1 = enabled
iOSSubdir="/ios" # make this an empty string to save in same dir
androidSubdir="/android" # make this an empty string to save in same dir
help() {
echo ""
echo "Usage: ./$(basename "$0") <your_1024x1024.png>"
echo " --------------------------------------------------------------------------------------"
// tag for a soundcloud html5 player
$scCode=$params['code'];
echo '<iframe width="100%" height="132" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' . $scCode . '&amp;auto_play=false&amp;hide_related=true&amp;show_comments=false&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>';
@millipedia
millipedia / gist:7962ff5daac76cf146fc
Created January 22, 2015 18:24
remove ds_store files before git push
//lord I hate apple.
//if git complains about not being able to merge binary file . DS_Store then run
git rm --cached .DS_Store
@millipedia
millipedia / gist:eac4dbfb7e38c0c755fb
Created September 22, 2014 15:07
Adb logcat for Codova on Mac.
adb logcat CordovaLog:D *:S
@millipedia
millipedia / cmsms_udt_youtube
Last active March 13, 2019 11:30
CMS Made Simple User Defined Tag for embedding a Youtube video
// write out an embed tag for a youtube vid.
$ytCode=$params['code'];
if(isset($params['height'])){
$height=$params['height'];
}else{
$height=290;
}
if(isset($params['width'])){