Skip to content

Instantly share code, notes, and snippets.

View acusti's full-sized avatar
Black Lives Matter

Andrew Patton acusti

Black Lives Matter
View GitHub Profile

Video.js disposal in overlay box

Reduced test case for creating and disposing of video.js players in a (colorbox) overlay box.

A Pen by Andrew Patton on CodePen.

License.

@acusti
acusti / Buttons-hover-effect.markdown
Last active August 29, 2015 14:08
A Pen by Andrew Patton.
@acusti
acusti / Towards-a-more-perfect-link-underline.markdown
Last active August 29, 2015 14:10
Towards a more perfect link underline
@acusti
acusti / CodePen-→-WebPageTest.markdown
Created December 21, 2014 15:49
CodePen → WebPageTest

CodePen → WebPageTest

Building a script to overlay some options, then send current pen’s debug URL to WebPageTest.

Todo:

  • Rename .key to something else so React doesn't complain
  • Validate form fields on submit
  • Add Close button to overlay form
  • Add UI to help users determine how to enter location and understand options
  • If possible, add option to specify multiple locations
// Take an array of meeting time ranges and return an array of condensed ranges
// https://www.interviewcake.com/question/merging-ranges
function condense_meeting_times(times) {
let timeline = [];
times.forEach((time) => {
//time[0], time[1]
// time is a tuple witih beginning and end
if (timeline[time[0]] === undefined) {
timeline[time[0]] = time[1];
@acusti
acusti / Shopp-fr_FR.po
Created July 26, 2011 03:10
Shopp .po language file French translation
# Copyright (C) 2010 Shopp
# This file is distributed under the same license as the Shopp package.
msgid ""
msgstr ""
"Project-Id-Version: Shopp 1.2dev\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/shopp\n"
"POT-Creation-Date: 2011-06-01 16:14:53+00:00\n"
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@acusti
acusti / functions.php
Last active December 12, 2015 08:09
WordPress: Add custom TinyMCE button that wraps selection in given tag with a couple extra functions from within your theme’s functions.php
<?php
/**
* Filter TinyMCE wysiwig editor to include custom button
*
* @since MyTheme 1.0
*
* @param $buttons TinyMCE button array
* @return $buttons TinyMCE button array
*/

Animate scroll with CSS3 transition (with jQuery)

Same as the sans jQuery version from which it was forked but with jQuery.

A Pen by Andrew Patton on CodePen.

License.

@acusti
acusti / blackbox.js
Last active December 30, 2015 22:39
JS file for the Blackbox Debug Bar WordPress plugin (http://wordpress.org/plugins/blackbox-debug-bar/)
hljs.initHighlightingOnLoad();
var WpDebugBar = {
element: ['globals', 'profiler', 'database', 'errors'],
open: null,
switchPanel: function(open) {
@acusti
acusti / dropdown-touch.js
Last active July 11, 2017 18:00
Plain vanilla JS with no dependencies to add touch device support for drop down menus (nested unordered list style). CSS selectors to display nested `<ul>` should look like: `body.no-touch ul.menu > li:hover > ul, ul.menu > li.tapped > ul { display: block; }`
(function(doc) {
// Add touch device support for dropdown menu
if (('addEventListener' in doc) && ('querySelectorAll' in doc) && (('ontouchstart' in window) || ('onmsgesturechange' in window))) {
var menu_item_selector = '.the-menu > div > ul > li',
menu_items = doc.querySelectorAll(menu_item_selector),
touchStart;
// Set up touch start handler
touchStart = function() {
if (this.className.indexOf(' tapped') > -1) {