Skip to content

Instantly share code, notes, and snippets.

@jsit
jsit / .gitconfig
Created Dec 22, 2020
Git config with conditional to test Git version
View .gitconfig
[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 / fimoculous-blogs.opml
Last active Sep 14, 2020
fimoculous blogs of the year rss opml
View fimoculous-blogs.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 / blogger-minima-blue.html
Last active Jan 4, 2020
Minima Blue Blogger Theme
View blogger-minima-blue.html
<!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 Sep 18, 2019
Native Vim search with Ag, including second parameter for filename match pattern
View ag-filename-match.vim
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 Dec 20, 2018
GitHub File View Bookmarklets
View GitHub File View Bookmarklets.md

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<%20files.length;%20i++)%20{%20files[i].click();%20}

@jsit
jsit / .stylelintrc
Created Aug 7, 2017
.stylelintrc / stylelint-order rules for SMACSS property sort order
View .stylelintrc
"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 / functions.php
Created Apr 17, 2017
Allow CodePen attributes in <p> tags
View functions.php
<?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,
@jsit
jsit / functions.php
Last active Apr 17, 2017
Allow WordPress editors to post unfiltered HTML
View functions.php
function allow_editors_to_post_html() {
$role_object = get_role( 'editor' );
$role_object->add_cap( 'unfiltered_html' );
}
add_filter( 'admin_init', 'allow_editors_to_post_html' );
@jsit
jsit / pinboard-bookmarklet.js
Last active Nov 9, 2020
Pinboard Bookmarklet -- Use text selection for description if available, otherwise use meta description, and include referrer in description if exists.
View pinboard-bookmarklet.js
javascript: q = location.href;
q = q.replace(/[?&]utm_[^&]*/g, "");
q = q.replace(/[?&]mc_[^&]*/g, "");
q = q.replace(/[?&]src=[^&]*/g, "");
q = q.replace(/[?&]ref=[^&]*/g, "");
desc = "";
if (document.getElementsByName("description").length > 0) {
desc = document.getElementsByName("description")[0].getAttribute("content")
"\n\n"
} else if (document.getElementsByName("Description").length > 0) {
@jsit
jsit / sieve.js
Last active Mar 30, 2017
Notifications / mailing lists / bulk email sieve code (for e.g. Fastmail et al.)
View sieve.js
if
anyof(
header :contains [
"List-Archive",
"List-Post",
"X-no-archive"
] [""],
header :is "Precedence" [
"list"
]