Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremy Keith adactio

View GitHub Profile
@adactio
adactio / tabledisplaytest.html
Created Aug 16, 2011
Content-first table-display test
View tabledisplaytest.html
<!DOCTYPE html>
<html>
<head>
<title>Table Display test</title>
<style>
@media screen and (min-width: 30em) {
body {
display: table;
caption-side: top;
}
@adactio
adactio / yourdomain.com.conf
Last active Dec 13, 2016
HTTPS domain settings on Apache 2.4.7: https://adactio.com/journal/10727
View yourdomain.com.conf
<VirtualHost *:80>
ServerAdmin you@yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /path/to/yourdomain
Redirect / https://yourdomain.com/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin you@yourdomain.com
@adactio
adactio / linkTwitterProfiles.php
Created Feb 2, 2017
A regular expression for turning a word beginning with @ into a link to a Twitter profile.
View linkTwitterProfiles.php
<?php
$string = preg_replace(
'/(?<=^|\s)@([a-z0-9_]+)/i',
'<a href="https://twitter.com/$1">@$1</a>',
$string
);
?>
View conditionalcats.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Can’t Hug Every Cat</title>
<style>
body {
font: 1em/1.5 Cambria, Georgia, serif;
margin: 0 5%;
@adactio
adactio / mediaquerycolums.html
Created Jan 12, 2012
Multiple columns dependent on media queries that test for height as well as width.
View mediaquerycolums.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Media Query Multiple Columns</title>
<meta name="viewport" content="width=device-width, intial-scale=1">
<style>
@media all and (min-width: 40em) and (min-height: 36em) {
[role="main"] {
-webkit-column-count: 2;
@adactio
adactio / twitter-user-stylesheet.css
Created Dec 14, 2011
CSS rules to hide "Trending Topics" and "Who To Follow" on new new Twitter.
View twitter-user-stylesheet.css
[data-component-term="trends"] *,
[data-component-term="user_recommendations"] * {
display: none !important;
}
@adactio
adactio / boilerplate.html
Created Aug 17, 2017
My boilerplate for HTML
View boilerplate.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
</body>
@adactio
adactio / webmention-form.html
Last active Dec 9, 2017
The form I put at the end of every blog post I make so that you can ping my webmention endpoint with your response.
View webmention-form.html
<form method="post" action="/webmention">
<p>Have you published a response to this?
<label for="webmention-source">Let me know the <abbr title="Uniform Resource Locator">URL</abbr></label>:
</p>
<input type="url" name="source" id="webmention-source">
<input type="hidden" name="target" value="https://adactio.com/journal/6495/">
<input type="submit" value="Ping!">
</form>
@adactio
adactio / postforms.js
Created Mar 2, 2014
Show a progress bar when a form is submitted (and prevent more than one submission per document).
View postforms.js
/*
Show a progress element for any form submission via POST.
Prevent the form element from being submitted twice.
*/
(function (win, doc) {
'use strict';
if (!doc.querySelectorAll || !win.addEventListener) {
// doesn't cut the mustard.
return;
}
View postToTwitter.php
<?php
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
function postToTwitter($data=array()) {
require_once 'OAuth.php';
$consumerKey = 'XXXX';