Skip to content

Instantly share code, notes, and snippets.

View quinn's full-sized avatar
🐁
huh

Quinn Shanahan quinn

🐁
huh
View GitHub Profile
import React from 'react'
var store = {
_finishedUpdating () {
this.listeners.forEach(listener => {
var value = findInTree(state, listener.property)
listener.callback(value)
})
}
add_action( 'rest_api_init', 'create_api_posts_meta_field' );
function create_api_posts_meta_field() {
register_rest_field( 'post', 'custom_fields', array(
'get_callback' => 'get_post_meta_for_api',
'schema' => null,
)
);
}
journalctl -b -u service-name -f
sudo find /tmp/ -iregex ".*\.\(tif?f\|png\|jpe?g\)" -delete
@quinn
quinn / chromebgtab
Last active November 11, 2016 13:39
#!/usr/bin/env bash
# orig: osascript -e 'tell application "Google Chrome" to open location "\1"'
osascript <<EOF
tell application "Google Chrome"
set activeIndex to get active tab index of window 1
tell window 1
set newTab to make new tab with properties {URL:"$1"}
end tell
set active tab index of window 1 to activeIndex
{
  inner: "always" | "never" | "before" | "after"
  outer: "always" | "never" | "before" | "after"
  prefer: "inner" | "outer"
  outerExceptions: "inCallExpressions" | "inNewExpressions" | "inArrayExpressions" | "inProperties" | "singleLine"
  innerExceptions: "blocks" | "classes" | "switches"
}
go to line:
:14
# markdown to html link
\[([^\]]+)]\(([^\)]+)\)
<a href="\2">\1</a>
# ruby old hash to new hash
:([a-zA-Z_]+)(\s+)=> # trailing space
\1:\2
@quinn
quinn / lossless-compression.sh
Last active August 29, 2015 14:22
lossless compression
find path/to/images -name "*.jpg" -exec sh -c "(jpegtran -optimize -copy none -outfile {}-compressed {} && mv {}-compressed {}) || echo ERROR: {}" \;
find path/to/images -name "*.png" -exec sh -c "optipng -o 3 {}" \;
@quinn
quinn / apache.conf
Last active August 29, 2015 14:04
Reason Standalone
Listen 5000
PidFile tmp/httpd.pid
LockFile tmp/accept.lock
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.