cat ~/bin/git-recent
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 | |
for app in \ | |
Docker \ | |
Slack \ | |
Firefox\ Developer\ Edition | |
Your\ Other\ Work\ Applications | |
do | |
echo -n "Launch $app? [Yn] " | |
read answer |
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 | |
/** | |
* Plugin Name: Blocks endpoint for Posts | |
* Description: — | |
*/ | |
add_action( 'rest_api_init', 'mcsf_register_post_blocks_endpoint' ); | |
function mcsf_register_post_blocks_endpoint() { | |
register_rest_route( | |
'wp/v2', '/posts/(?P<id>[\d]+)/blocks', array( |
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 | |
# Given an input documentation file, output all JavaScript code snippets | |
# contained therein. | |
INPUT_DOC="$1" | |
OPENING_LINES=$( sed -n '/^```js$/=' "$INPUT_DOC" ) | |
for LINE in $OPENING_LINES; do |
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
diff --git a/lib/blocks.php b/lib/blocks.php | |
index e28971bad..a2c1d0a89 100644 | |
--- a/lib/blocks.php | |
+++ b/lib/blocks.php | |
@@ -177,14 +177,18 @@ function do_blocks( $content ) { | |
} | |
} | |
- // Replace dynamic block with server-rendered output. | |
- $rendered_content .= $block_type->render( $attributes ); |
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
#!/usr/bin/env python | |
import sys | |
import re | |
re_full = r'(MMM|MM|M)?(CM|CD|DCCC|DCC|DC|D|CCC|CC|C)?(XC|XL|LXXX|LXX|LX|L|XXX|XX|X)?(IX|IV|VIII|VII|VI|V|III|II|I)?' | |
re_appr = r'\b[MDCLXVI]+\b' | |
def wrap_roman(matchobj): | |
s = matchobj.group(0) |
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
javascript:(function() { var s=getSelection(),r=document.createRange(),e=document.createElement('input'); e.value=[document.querySelector('.js-issue-title').innerText,location.origin+location.pathname].join(' '); document.body.appendChild(e); r.selectNode(e); s.removeAllRanges(); s.addRange(r); document.execCommand('copy'); e.remove(); }()); |
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
/** | |
* Please don't use this pattern. | |
* | |
* Explores a sweetened syntax for (p)react event handlers akin to Vue's, which | |
* allows: | |
* - <my-el v-on:click="say" /> | |
* - <my-el v-on:click="say( 'hi' )" /> | |
* - <my-el v-on:click="counter += 1" /> | |
* | |
* In this case, the following become possible: |
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
import { concat, liftN } from 'ramda' | |
const flip = () => [ [ 'h' ], [ 't' ] ] | |
const concatFlips = liftN(2, concat) | |
const twoFlips = concatFlips(flip(), flip()) | |
const threeFlips = concatFlips(twoFlips, flip()) | |
twoFlips | |
// [ [ 'h', 'h' ], [ 'h', 't' ], [ 't', 'h' ], [ 't', 't' ] ] |
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
if (typeof Object.assign != 'function') { | |
// from MDN | |
Object.assign = function(target, varArgs) { // .length of function is 2 | |
'use strict'; | |
if (target == null) { // TypeError if undefined or null | |
throw new TypeError('Cannot convert undefined or null to object'); | |
} | |
var to = Object(target); |