Skip to content

Instantly share code, notes, and snippets.

@gsimone
gsimone / absolute-imports-in-create-react-app.md
Last active December 31, 2018 11:10
Easily add absolute imports in create react app

Easy absolute imports in VSC + Create React Apps

create-react-apps supports absolute imports via .env

.env

    NODE_PATH=src

this will make webpack look for absolute imports (imports without .. or /) in the src directory of our project, meaning we can do something like this

@petenelson
petenelson / admin_head_post_edit_check.php
Created November 1, 2012 17:03
WordPress admin action hooks for listing/adding/editing posts or pages
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}