Skip to content

Instantly share code, notes, and snippets.

View millipedia's full-sized avatar

millipedia millipedia

View GitHub Profile
@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'])){
@millipedia
millipedia / fix_mangled_mysql
Last active February 2, 2017 09:51
Fix mangled chars in MySQL DB. Original info here http://jonisalonen.com/2010/mysql-character-encoding/
//general case is:
update table set column = convert(binary column using utf8);
// if we've just moved a cmsms db then this is a good start
// but you'll have to do any module specific bits.
update cms_content_props set content = convert(binary content using utf8);
update cms_htmlblobs set html = convert(binary html using utf8);
update cms_module_news set news_data = convert(binary news_data using utf8);