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
tell application "Finder" | |
try | |
set appPath to (path to application "Evernote" as text) | |
on error | |
display dialog "Couldn't find Evernote. Is it installed?" | |
end try | |
set printPath to (path to "dlib" from user domain as text) & "PDF Services" | |
make new alias at printPath to appPath with properties {name:"Send PDF to Evernote"} | |
end tell |
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 | |
# (c) 2012 Brett Kelly. | |
# Licensed under the MIT license | |
# http://www.opensource.org/licenses/mit-license.php | |
import re | |
import sys | |
from urlparse import urlparse |
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
# Python OAuth example | |
import evernote.edam.userstore.constants as UserStoreConstants | |
import evernote.edam.type.ttypes as Types | |
from evernote.api.client import EvernoteClient | |
## | |
# Helper function to turn query string parameters into a | |
# Python dictionary | |
## |
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 | |
// Hide the Inventory nav item for everybody except admins and buyers | |
function rw_hide_inventory_link_for_role() { | |
$allowed_roles = ['administrator', 'rw-buyer']; // these user roles can see the item | |
$hide = true; // default to hiding it | |
if ( is_user_logged_in() ) { | |
$user = wp_get_current_user(); | |
$roles = (array)$user->roles; | |
foreach($roles as $role) { |
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 | |
/* | |
Collect and display a sorted, unordered list element containing all children of the current post | |
Supported attributes: | |
`remove` = this string will be removed in the resulting links | |
`exclude` = posts whose title contains one of these comma-separated strings will be omitted | |
TODO: fix both params to be pipe-delimited because flexibility | |
*/ |
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
-- copy selected text | |
tell application "System Events" | |
keystroke "c" using command down | |
end tell | |
-- switch to nvAlt | |
tell application "nvALT" | |
activate | |
tell application "System Events" | |
keystroke "l" using command down -- Create or Search |
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
states = { | |
'AK': 'Alaska', | |
'AL': 'Alabama', | |
'AR': 'Arkansas', | |
'AZ': 'Arizona', | |
'CA': 'California', | |
'CO': 'Colorado', | |
'CT': 'Connecticut', | |
'DC': 'District of Columbia', | |
'DE': 'Delaware', |
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
elements = [".some-class", "#some-id"]; // selectors for each element to suppress events | |
events = ["mouseover", "click"]; // events to suppress | |
document.addEventListener("fullscreenchange", (event) => { | |
// fullscreen event fired | |
elements.forEach((element) => { | |
events.forEach((event) => { | |
if (document.fullscreenElement) { | |
// some element has fullscreen now | |
document.querySelectorAll(element).forEach((el) => { | |
el.addEventListener(event, (e) => { |
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 React, {useState, useEffect} from "react" | |
import {useRouter} from 'next/router' | |
const Event = ({embed}) => { | |
const router = useRouter() | |
const [embedSRC, setEmbedSRC] = useState(embed); | |
// useEffect(() => { | |
// const handleRouteChange = () => { | |
// setEmbedSRC(embed) | |
// } |
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 | |
// ganked this from a FB group thread that linked to a dead E doc page. | |
// Storing here for reference/posterity. | |
function archive_callback( $title ) { | |
// make this a switch if you want to handle a bunch of different CPTs in one go | |
if ( is_post_type_archive('my_cpt_slug') ) { | |
return 'My custom archive title, baybay'; | |
} |
NewerOlder