Skip to content

Instantly share code, notes, and snippets.

View michaelmcandrew's full-sized avatar

Michael McAndrew michaelmcandrew

View GitHub Profile
@michaelmcandrew
michaelmcandrew / README.md
Created February 1, 2019 00:04
wfosspay-survey-results

Answers to the what foss project are you survey

The following bash command...
for TLD in $(grep -E '^[a-z]+$' public_suffix_list.dat); do echo $(grep $TLD /usr/share/dict/words | wc -l) $TLD; done | grep -v ^0 | sort -nr
...using a list of tlds from https://publicsuffix.org/list/public_suffix_list.dat gives
16147 in
13129 es
9573 ng
9276 re
@michaelmcandrew
michaelmcandrew / civicrm_user_fields.php
Last active November 22, 2018 02:26
Proof of concept WP shortcode to display fields from logged in and other contacts
<?php
/*
This is very much WIP / proof of concept / scratching an itch. Lots of stuff missing, like ACL.
Just sharing some early attempts at WP plugin development. Feedback welcome.
For example...
<?php
public function invoke(
$names,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
) {
if (is_array($names) && !defined('CIVICRM_FORCE_LEGACY_HOOK') && \Civi\Core\Container::isContainerBooted()) {
$event = \Civi\Core\Event\GenericHookEvent::createOrdered(
$names,
array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6)
@michaelmcandrew
michaelmcandrew / createDemoData.php
Created March 19, 2018 22:35
Creating related entities in CiviCRM
<?php
// Reference other entities in params with '{{entity.tag}}'
echo "Creating demo data...\n";
$entities['ChatConversationType'] = [
'pets' => [
'name' => 'Cats or dogs?',
'timeout' => '30'

test

Screenshot

(*FIXME: In one or two paragraphs, describe what the extension does and why one would download it. *)

The extension is licensed under AGPL-3.0.

Requirements

@michaelmcandrew
michaelmcandrew / index.js
Created September 7, 2017 13:49
requirebin sketch
var Inky = require('inky').Inky;
var cheerio = require('cheerio');
var options = {};
var input = '<row></row>';
// The same plugin settings are passed in the constructor
var i = new Inky(options);
var html = cheerio.load(input)
@michaelmcandrew
michaelmcandrew / README.md
Last active May 2, 2017 09:08
Michael's encrypted UEFI Arch Linux on UK Lenovo X220 install script

This gist serves as an installation guide for Arch Linux on Michael's UK X220 with the following characteristics

  • GPT partition table
  • UEFI booting

Usage

Creating the installation media

Download the latest archlinux ISO and create a bootable USB stick

@michaelmcandrew
michaelmcandrew / convert.php
Last active April 14, 2017 11:03
Convert (civicrm-docs) markdown to epub
#!/usr/bin/env php
<?php
// composer require symfony/yaml (or incorperate it into civicrm-docs (or similar) to get this up and running.
require __DIR__ . '/vendor/autoload.php';
if(!realpath($argv[1])){
die("Could not find {$argv[1]}\n");
}
@michaelmcandrew
michaelmcandrew / CRM_Whizzy_Page_Whiz.php
Last active March 28, 2017 17:51
Using composer in extensions
<?php
class CRM_Whizzy_Page_Whiz extends CRM_Core_Page {
public function run() {
$rule = new \Recurr\Rule;
parent::run();
// etc...