Skip to content

Instantly share code, notes, and snippets.

John Gardner Alhadis

Block or report user

Report or block Alhadis

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
View format-diff-coloured.sed
/^--- /,/^+++ /d
/^\\ No newline at end of file$/d
s/^-/-/
s/^+/+/
s/^@/@/
View config.json
{
"source": {
"includePattern": "\\.+(mjs|js(on|x)?)$"
}
}
View index.html
<!DOCTYPE html>
<html lang="en-AU">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="initial-scale=1, minimum-scale=1" />
<title>Cross-browser/Electron file selection</title>
</head>
@Alhadis
Alhadis / an.tmac
Last active Jan 30, 2020
troff-temp
View an.tmac
' # month name
.if "\nd"0" .nr m \n(mo-1
.if "\nm"0" .ds ]m January
.if "\nm"1" .ds ]m February
.if "\nm"2" .ds ]m March
.if "\nm"3" .ds ]m April
.if "\nm"4" .ds ]m May
.if "\nm"5" .ds ]m June
.if "\nm"6" .ds ]m July
.if "\nm"7" .ds ]m August
@Alhadis
Alhadis / extract-unicode-names.js
Created Apr 29, 2019
extract-unicode-names.js
View extract-unicode-names.js
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const unicodeData = fs.readFileSync("UnicodeData.txt", "utf8")
.trim().split("\n").map(line => {
const fields = line.split(";");
return {
codePoint: fields[0],
View match-url.pl
#!/usr/bin/env perl
# Adopted from https://github.com/atom/language-hyperlink
use strict;
use warnings;
use v5.14;
my $matchURL = qr~ \b
# Protocol
( https?
| s?ftp
@Alhadis
Alhadis / node-entry.bat
Created Mar 4, 2019
Cross-platform entry-point for Node.js apps
View node-entry.bat
@echo off
SETLOCAL
:: Determine availability of required programs
call :which node
@if "%_path%"=="" (
echo This program requires Node.js to run. >&2
echo Download from https://nodejs.org >&2
exit /b 2
)
View blend-modes.c
/* From: http://web.archive.org/web/20090222030436/http://www.nathanm.com/photoshop-blending-math/ */
#define ChannelBlend_Normal(B,L) ((uint8)(B))
#define ChannelBlend_Lighten(B,L) ((uint8)((L > B) ? L:B))
#define ChannelBlend_Darken(B,L) ((uint8)((L > B) ? B:L))
#define ChannelBlend_Multiply(B,L) ((uint8)((B * L) / 255))
#define ChannelBlend_Average(B,L) ((uint8)((B + L) / 2))
#define ChannelBlend_Add(B,L) ((uint8)(min(255, (B + L))))
#define ChannelBlend_Subtract(B,L) ((uint8)((B + L < 255) ? 0:(B + L - 255)))
#define ChannelBlend_Difference(B,L) ((uint8)(abs(B - L)))
#define ChannelBlend_Negation(B,L) ((uint8)(255 - abs(255 - B - L)))
@Alhadis
Alhadis / primer-palette.js
Created Feb 19, 2019
Display Primer colour palette
View primer-palette.js
/**
* @fileoverview
* 1. Open any code file on GitHub
* 2. Copy+paste this into your dev-console
* 3. ????
* 4. No profit
*/
"use strict";
const el = document.querySelector(".blob-wrapper");
@Alhadis
Alhadis / dwb-darwin.patch
Last active Sep 11, 2018
Patches to compile DWB3.3 on macOS 10.13.6
View dwb-darwin.patch
diff --git a/text/eqn/e.h b/text/eqn/e.h
index 881354b..bf5ad3c 100644
--- a/text/eqn/e.h
+++ b/text/eqn/e.h
@@ -21,6 +21,7 @@ extern int class[LAST][LAST];
extern char errbuf[200];
extern char *cmdname;
+#undef sprintf
#define ERROR sprintf(errbuf,
You can’t perform that action at this time.