Skip to content

Instantly share code, notes, and snippets.

View mheap's full-sized avatar
:octocat:
Follow me on Twitter @mheap

Michael Heap mheap

:octocat:
Follow me on Twitter @mheap
View GitHub Profile
@mheap
mheap / workflow.yaml
Created March 9, 2023 12:56
Run steps with access to secrets on PRs from forks with GitHub Actions
name: Demo
on:
pull_request_target:
types: [opened, synchronize, labeled]
jobs:
demo:
runs-on: ubuntu-latest
steps:
- name: Check access
if: ${{ github.event.pull_request.author_association != 'COLLABORATOR' && github.event.pull_request.author_association != 'OWNER' && !contains(github.event.*.labels.*.name, 'ci:run-tests') }}

A wav file is a file with an audio header, then slices of pcm audio. To create a wav file from PCM, you need to add a wav header with the correct sample rate

// If you were looking for a way to describe a set of log messages, where
// each item contains the hash of the previous entry to build a chain, what
// would you call it?
//
// It's almost like a blockchain without the proof of work. I'm thinking as
// a security measure to prove that no items have been deleted
$seed = '52e2fb59e99dcd12528f92af25f401a6';
// Ignore the syntax and assume that $this->message points to the current
@mheap
mheap / stop.js
Last active December 15, 2017 16:48
// Sign up for nexmo.com
// Purchase a number
// Set the webhook URL for inbound messages (https://dashboard.nexmo.com/settings) to be yourdomain.com:3000/webhooks/sms-inbound
// Fill in the Twitter credentials below (you'll need to register an application at https://apps.twitter.com)
// Run this code
// Send STOP to the number you created
// Watch as @rosstuck gets a tweet asking him to stop
const app = require('express')()
const bodyParser = require('body-parser')
@mheap
mheap / example-one.js
Last active December 13, 2017 13:46
promise-and-callback-support
const promiseOrCallback = (promise, callback) => {
if (typeof callback != "function") {
return promise;
}
return promise
.then((result) => (callback(null, result)))
.catch(callback);
};
const foo = (a, b, callback) => {
@mheap
mheap / fix-infinality.md
Created March 23, 2017 13:24 — forked from cryzed/fix-infinality.md
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

---
driver:
name: docker
use_sudo: false
privileged: true
run_command: /usr/sbin/init
provisioner:
name: chef_zero
require_chef_omnibus: 12.7.2
class Foo {
private _bar: string;
public get bar(){
return this._bar;
}
public set bar(v: string){
this._bar = v;
}
@mheap
mheap / bio.md
Last active August 15, 2016 13:10

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise with audiences all around the world at user groups and conferences.

Day to day, Michael is a fixer. He works on whatever needs an extra pair of hands both at his day job and in open source projects. When not immersed in technology, you'll find him either playing various board games or hiking through the countryside.

WordPress as a 12 Factor App

Love it or hate it, WordPress is here to stay. Powering over 25% of the web, it’s one of the most commonly used projects out there.

WordPress strive to make life easy for their end users first and foremost, but what if I told you that with less than an hour’s work you could make it a joy to work with for developers too?

By following the Twelve Factor App methodology (http://12factor.net/) we can deploy WordPress in a way that makes it easy to develop, easy to update and easy to maintain. Come and watch as we take a standard WordPress install and bring it into the future.