Skip to content

Instantly share code, notes, and snippets.

@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2024 19:02
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@jkottke
jkottke / gist:8739051
Last active May 7, 2020 10:52
A list of design/writing/coding music recommendations from my Twitter followers
Not sure how to summarize/organize this into something useful. Some can be made into Spotify/Rdio playlists, but others are likely unavailable and some are just URLs to other services. Genre is all over the place as well...lots of ambient and classical, soundtracks, uptempo dancey stuff, rock w/ words, and even Slayer. Not sure all that can be put into one playlist that's useful for anyone. What I'm saying is, good luck!
fantoraygun ‏@fantoraygun 1h
@jkottke some great mixes here: http://musicforprogramming.net/
Andrew ‏@jandrewc 1h
@jkottke "From here we go sublime" by The Field and "Alive 2007" by Daft Punk.
Lenny ‏@lenny_ 1h
@jkottke SomaFM's Groove Salad station
@spigists
spigists / new_gist_file.css
Created October 2, 2013 16:16
Bootstrap 3 styles for Gravity Forms, make sure that in Forms > Settings you have Output CSS set to No and Output HTML5 set to Yes
.gform_wrapper ul {
padding-left: 0;
list-style: none; }
.gform_wrapper li {
margin-bottom: 15px; }
.gform_wrapper form {
margin-bottom: 0; }
@tdominey
tdominey / gist:6543642
Created September 12, 2013 20:53
Use {{ location.here }} variable to know which page you're viewing
<koken:if data="location.here" equals="/">
<!-- We're on the home page -->
</koken:if>
<koken:if data="location.here" equals="/albums/">
<!-- We're on the albums index -->
</koken:if>
<koken:if data="location.here" equals="/albums/portraits/">
<!-- We're on the portraits album page -->
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@smalot
smalot / PdfParser.php
Last active February 13, 2022 09:59
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@FernE97
FernE97 / typekit-enqueue.php
Last active April 20, 2019 01:46
PHP: WordPress Typekit wp_enqueue
<?php
function h5bs_enqueue_scripts() {
wp_enqueue_script( 'typekit', '//use.typekit.net/xxxxxxx.js' );
}
add_action( 'wp_enqueue_scripts', 'h5bs_enqueue_scripts' );
function h5bs_typekit_inline() {
@bradleyboy
bradleyboy / nginx.conf
Last active March 22, 2022 19:46
nginx rewrite setup for Koken
# Enable gzip. Highly recommending for best peformance
gzip on;
gzip_comp_level 6;
gzip_types text/html text/css text/javascript application/json application/javascript application/x-javascript;
# By default, do not set expire headers
expires 0;
# Set expires header for console CSS and JS.
# These files are timestamped with each new release, so it is safe to cache them agressively.
@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>