Skip to content

Instantly share code, notes, and snippets.

Chris Buckley cmbuckley

Block or report user

Report or block cmbuckley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

These snippets are to highlight a minor display discrepancy between desktop and mobile link unfurling in Slack.

The article:published_time OpenGraph tag can have an optional time component. When unfurling links, desktop always treats the tag as a date, and mobile always treats it as a datetime, regardless of the content of the tag.

The content can essily be passed into Slack using

cmbuckley /
Created Oct 10, 2019
Nexmo SMS script
function msisdn() {
sed 's/^0/44/' <<< "$1"
KEY= # Nexmo API key
SECRET= # Nexmo API secret
DEFAULT= # Default SMS sender

This is just an example for

The following commands were run to create this history:

git checkout -b dev
git commit --allow-empty -m 'Dev commit 1'
git commit --allow-empty -m 'Dev commit 2'
git commit --allow-empty -m 'Dev commit 3'
git checkout master
cmbuckley /
Last active Jun 12, 2019
Firedrill script
webhook_url="URL HERE"
"core,Core on-call:bearded_person::skin-tone-2"
cmbuckley /
Created Mar 13, 2019
Use 1Password to copy a password to the clipboard
[ -z "$OP_SESSION_my" ] && eval $(op signin my)
out="$(op get item "$1")"
jq -r '.details.fields | .[] | select(.type=="P") | .value' <<< "$out" | xclip -selection clipboard -i
echo "Password for $(jq -r '.overview.title' <<< "$out") copied to clipboard"
cmbuckley /
Created Feb 21, 2019
Add outer glow to images with transparent background
# Add 5px transparent border
convert file.png -bordercolor transparent -border 5 file-border.png
# Add a 3px blur based on the alpha channel
convert file-border.png \( +clone -background '#777777' -shadow 100x1+0+0 -channel A -level 0,100% -blur 0x3 \) -compose DstOver -gravity center -composite file-glow.png
# TODO combine the above
View test.php
$char = '';
// What's the UTF-8 encoding of this character? (This file is saved in UTF-8)
var_dump(bin2hex($char)); // e382a4
// What does another encoding look like?
// See
var_dump(bin2hex(mb_convert_encoding($char, "EUC-JP", "UTF-8"))); // a5a4
View nestingLolz.js
function nestingLolz(count) {
return [...Array(count)].reduce(function (a, c, i) {
return a + ' or my ' + Array(i + 1).fill('son').join('’s ');
}, 'Don’t talk to me') + ' ever again';
// haven't decided which I prefer :-)
function nestingLolzAlternate(count) {
return ['Don’t talk to me']
.concat([...Array(count)].map((e, i) => Array(i + 1).fill('son').join('’s ')))
cmbuckley / trapper.js
Last active Nov 21, 2018
JavaScript Cookie Trapper
View trapper.js
// Use to detect calls to document.cookie="xxx"
(function (){
var s = document.__lookupSetter__('cookie').bind(document),
g = document.__lookupGetter__('cookie').bind(document);
Object.defineProperty(document, 'cookie', {
get() {
return g();
set(n) {
cmbuckley /
Last active Sep 21, 2018
ImageMagick rounded corners
# if OUTFILE is omitted, outputs to STDOUT
convert $1 \( +clone -alpha extract -draw "fill black polygon 0,0 0,$size $size,0 fill white circle $size,$size $size,0" \( +clone -flip \) -compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) -alpha off -compose CopyOpacity -composite ${3:-png:-}
You can’t perform that action at this time.