View jquery.labels.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jQuery plugin to find all <label> elements | |
associated with the currently selected form field | |
elements (typically <input>, <select> or <textarea>) | |
eg: $('input').labels(); | |
*/ | |
$.fn.labels = function () { | |
return this.map(function () { | |
if (this.labels) { |
View parse-youtube-vimeo-urls.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Given a string containing any combination of YouTube and Vimeo video URLs in | |
* a variety of formats (iframe, shortened, etc), each separated by a line break, | |
* parse the video string and determine it's host and ID. | |
* | |
* Data gets returned in the format: | |
* | |
* array( | |
* array( |
View main.custom.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is for ServerPilot configurations | |
# and should be located at /etc/apache-sp/vhosts.d/<APPNAME>.d | |
# See: https://gist.github.com/rungta/fd7edc3940ca9279b2095fb961466b8d | |
<Directory ${DOCUMENT_ROOT}> | |
# Disable .htaccess files | |
AllowOverride None | |
# Include root/.htaccess file | |
# the last character is a glob so that it silently ignores missing file |
View imageoptim.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage | |
# imageoptim.sh /path/to/images/dir | |
# | |
# See: https://gist.github.com/rungta/0cc3f68beee42008e5cf05b2aa526954 | |
# Find image files modified in the last 24 hours |
View smoothscroll.jquery.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://css-tricks.com/snippets/jquery/smooth-scrolling/ | |
// modified to use native scrollIntoView when supported | |
// Select all links with hashes | |
$('html').on('click', 'a[href*="#"]', function(event) { | |
// On-page links | |
if ( | |
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && | |
location.hostname == this.hostname | |
) { |
View trello_to_markdown.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
""" | |
Render a Trello board's contents from JSON into a more human readable format (Markdown) | |
Sample output: | |
Board Name | |
========== | |
List Name |
View _vanity_router.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Treat the slug as a template path #} | |
{% set template = include(top_level_slug, ignore_missing = true) %} | |
{# Render the template contents if found, otherwise treat the slug as a username #} | |
{% if template is not empty %} | |
{{- template|raw -}} | |
{% else %} | |
{%- include 'users/_profile' with { username: top_level_slug } -%} | |
{% endif %} |
View fontloader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* fontloader.js | |
Helps you avoid FOIT and progressively load in multiple | |
sets of webfonts as asynchronous non-blocking resources. | |
Apply them on the page when the fonts are ready, like so: | |
.title-type { font-family: serif; } | |
.prose-type { font-family: sans-serif; } | |
View _init.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# _init.twig #} | |
{# | |
Usage | |
extend `_init` | |
set `doNotCache` to true to exclude a page | |
set `cacheKey` to a string to cache a template globally | |
(as opposed to by URL). eg: 404 template | |
modify `cacheKeyPrefix` to include variation params, if any | |
#} |
View jquery.external-links-new-window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Open all external links in a new window | |
*/ | |
(function ($) { | |
function openExternalLinksInNewWindows() { | |
$('a') | |
.filter('[href^="http"], [href^="//"]') | |
.not('[href*="' + window.location.host + '"]') | |
.attr('rel', function (i, val) { | |
return 'noopener noreferrer ' + (val || ''); |
OlderNewer