Skip to content

Instantly share code, notes, and snippets.

View jsit's full-sized avatar
👾

Jay Sitter jsit

👾
View GitHub Profile
javascript:(function()%7Bvar%20tidyurl=window.location.href.replace(/utm_(term%7Ccontent%7Csource%7Cmedium%7Ccampaign)=%5B%5E&%5D+&?/g,%22%22).replace(/mc_(eid%7Ccid)=%5B%5E&%5D+&?/g,%22%22).replace(/ref=%5B%5E&%5D+&?/g,%22%22).replace(/%5C??$/g,%22%22);if(history.replaceState)%7Bhistory.replaceState(null,%22%22,tidyurl)%7Delse%7Bwindow.location=tidyurl%7D%7D)();
@jsit
jsit / soundcloud.php
Last active June 7, 2021 05:12
PHP preg_replace strings for AMP HTML extensions
$body = preg_replace( '/<iframe\b[^>]*soundcloud.com\/tracks\/(\d*).*"[^>]*>(.*?)>/', '<amp-soundcloud height=300 layout="fixed-height" data-trackid="$1" data-visual="true"></amp-soundcloud>', $body );
@jsit
jsit / .gitconfig
Created December 22, 2020 15:42
Git config with conditional to test Git version
[alias]
lg = "!if (( \
$(echo \"$(git --version | sed -E 's/git version ([0-9]+.[0-9]+).*/\\1/') > 2.20\" | bc) \
)); then \
DATE="--date=human"; \
else \
DATE="--date=short"; \
fi; \
git log --pretty=tiny --abbrev-commit --$DATE"
@jsit
jsit / .stylelintrc
Created August 7, 2017 15:19
.stylelintrc / stylelint-order rules for SMACSS property sort order
"order/properties-order": [
{ "properties": [ "content", "quotes" ] },
{ "properties": [ "display", "visibility" ] },
{ "properties": [ "position", "z-index", "top", "right", "bottom", "left" ] },
{ "properties": [ "box-sizing" ] },
{ "properties": [ "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "align-content", "align-items", "align-self", "justify-content", "order" ] },
{ "properties": [ "width", "min-width", "max-width", "height", "min-height", "max-height" ] },
{ "properties": [ "margin", "margin-top", "margin-right", "margin-bottom", "margin-left" ] },
{ "properties": [ "padding", "padding-top", "padding-right", "padding-bottom", "padding-left" ] },
@jsit
jsit / fimoculous-blogs.opml
Last active September 14, 2020 17:50
fimoculous blogs of the year rss opml
<?xml version="1.0" encoding="UTF-8"?>
<opml>
<outline text="fimoculous">
<outline xmlUrl="http://amysrobot.com/index.rdf" />
<outline xmlUrl="http://busblog.tonypierce.com/feed" />
<outline xmlUrl="http://diablocody.blogspot.com/feeds/posts/default?alt=rss" />
<outline xmlUrl="http://earlboykins.blogspot.com/feeds/posts/default?alt=rss" />
<outline xmlUrl="http://eyeteeth.blogspot.com/feeds/posts/default?alt=rss" />
<outline xmlUrl="http://feeds.feedburner.com/Artsjournal" />
<outline xmlUrl="http://feeds.feedburner.com/Metafilter" />
@jsit
jsit / wp-all-import-events-manager.php
Last active March 5, 2020 17:35
Allow WP All Import to create events with Events Manager
// Create a proper EM_Event object in the database when an event-type post is
// imported with WP All import
add_action('pmxi_saved_post', 'post_saved', 10, 1);
function post_saved($post_id) {
if (class_exists(EM_Event)) {
$event_post = get_post($post_id);
// Only create a new event entry if the imported post is of type event and
// there is not an existing event for this post
$existing_event = em_get_event($event_post->ID, 'post_id');
@jsit
jsit / blogger-minima-blue.html
Last active January 4, 2020 22:31
Minima Blue Blogger Theme
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><$BlogPageTitle$></title>
<$BlogMetaData$>
<style type="text/css">
/*
@jsit
jsit / ag-filename-match.vim
Last active September 18, 2019 17:29
Native Vim search with Ag, including second parameter for filename match pattern
function! ParseAgList(...)
let l:string = join(a:000)
" http://vpaste.net/qTrzV
" Thanks irc://chat.freenode.net/m_ben,isnick
let l:pat = '\v%([^\\]\\)@<!\s+|([''"])%(.{-})\\@<!\1\zs\s*'
let l:args = split(l:string, pat)
if len(l:args) > 1
" sanitize
@jsit
jsit / GitHub File View Bookmarklets.md
Created December 20, 2018 19:35
GitHub File View Bookmarklets

GitHub File View Bookmarklets

Collapse JS

javascript:var%20files%20=%20document.querySelectorAll('.file-header[data-path$=".js"]%20.js-details-target[aria-expanded=true]');%20for%20(i%20=%200;%20i%20<%20files.length;%20i++)%20{%20files[i].click();%20}

Expand JS

javascript:var%20files%20=%20document.querySelectorAll('.file-header[data-path$=".js"]%20.js-details-target[aria-expanded=false]');%20for%20(i%20=%200;%20i%20<%20files.length;%20i++)%20{%20files[i].click();%20}

Show all comments

javascript:var%20files%20=%20document.querySelectorAll('.js-toggle-file-notes:not(:checked)');%20for%20(i%20=%200;%20i%20&lt;%20files.length;%20i++)%20{%20files[i].click();%20}

@jsit
jsit / functions.php
Created April 17, 2017 16:17
Allow CodePen attributes in <p> tags
<?php
function add_allowed_tags($tags, $context) {
if ($context === 'post') {
$tags['p'] = array(
'data-height' => true,
'data-theme-id' => true,
'data-slug-hash' => true,
'data-default-tab' => true,