Skip to content

Instantly share code, notes, and snippets.

@pathawks
pathawks / Liquid Minify for Jekyll.md
Last active November 20, 2023 13:52
Liquid Minify

Simply call this template from your master Jekyll template, and your site will be (more or less) minified

@pathawks
pathawks / OpenGraph for Blogger.md
Last active October 28, 2023 23:41
OpenGraph for Blogger

Adding Open Graph metadata to Blogger is easy. Simply copy the code below and paste it into your template after the <header> tag.

A couple notes:

  • og:locale Should probably actually reflect the blog's locale instead of just being a hardcoded string. Unfortunately, Blogger only gives us en-us with a hyphen, instead of an underscore, so that won't work.
  • If you're using your blog as a personal profile, you may consider changing the second og:type from website to profile and adding your personal information
  • og:image Is only supplied if Blogger finds an image in the current post. However, not supplying og:image is invalid. You could provide an alternate image of your blog logo, or a Gravatar.
  • If you do something cool with this, I'd love to hear about it. pathawks@shortmail.com
@pathawks
pathawks / meta.html
Last active May 20, 2020 19:27
Open Graph for Jekyll
{% if include.content %}
<meta property="{{ include.property }}" content="{{ include.content }}" />
{% endif %}
<?php /* With apologies to Dr. Drang and John Siracusa.
feed-subscribers.php
By Marco Arment.
Released into the public domain with no warranties and no restrictions.
Usage: Pipe an Apache access log into stdin, e.g.:
php -f feed-subscribers.php < /var/log/httpd/access_log
@pathawks
pathawks / allPrimes.c
Last active April 8, 2018 18:33
allPrimes
/**
* @author: Pat Hawks
* Created on: Aug 28, 2014
* Source File: allPrimes.c
*/
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
(set-info :smt-lib-version 2.6)
(set-logic QF_LIA)
(set-option :produce-models true)
(set-info :status sat)
(declare-const board11 Int)(assert (= 1 board11))
(declare-const board12 Int)(assert (= 9 board12))
(declare-const board13 Int)(assert (and (<= 1 board13)(<= board13 9)))
(declare-const board14 Int)(assert (and (<= 1 board14)(<= board14 9)))
(declare-const board15 Int)(assert (and (<= 1 board15)(<= board15 9)))
(declare-const board16 Int)(assert (and (<= 1 board16)(<= board16 9)))
@pathawks
pathawks / index.js
Last active April 9, 2016 04:28
Slack Google slash command
const qs = require('querystring');
const https = require('https');
const url = require('url');
const googleLink = function (text) {
const query = encodeURIComponent(text).replace(/%20/g,'+');
return "<https://www.google.com/search?q=" + query + "|google.com/search?q=" + query + ">";
}
const qrCode = function (url) {
@pathawks
pathawks / Swift.md
Last active February 19, 2016 22:09
I ❤️ Swift

I ❤️ Swift

📜 View The Slides

About Swift Philosophy

Swift is friendly to new programmers. It is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.

The compiler is optimized for performance, and the language is optimized for development, without compromising on either. It’s designed to scale from “hello, world” to an entire operating system.

@pathawks
pathawks / pygments.scss
Created January 27, 2014 03:42
GitHub Pygments
// Colors
$comment: #999988;
$special: #999999;
$generic: #000000;
$keyword: #000000;
$string: #dd1144;
$name: #990000;
$number: #009999;
$variable: #008080;
@pathawks
pathawks / content-emoji.html
Last active January 2, 2016 11:09
Jekyll include to replace ASCII smileys with emoji
{{ content | replace:'<span>:p</span>','<span class="emoji">&#128541;</span><span class="noemoji">:p</span>' | replace:'<span>;p</span>','<span class="emoji">&#128540;</span><span class="noemoji">:p</span>' | replace:'<span>;)</span>','<span class="emoji">&#128521;</span><span class="noemoji">;)</span>' | replace:'<span>:D</span>','<span class="emoji">&#128515;</span><span class="noemoji">:D</span>' | replace:'<span>:)</span>','<span class="emoji">&#128512;</span><span class="noemoji">:)</span>' | replace:'<span>(:</span>','<span class="emoji">&#128512;</span><span class="noemoji">(:</span>' | replace:'<span>X(</span>','<span class="emoji" title="Persevering Face">&#128547;</span><span class="noemoji">X(</span>' | replace:'<span>:(</span>','<span class="emoji" title="Disappointed Face">😞</span><span class="noemoji">:(</span>' }}