Skip to content

Instantly share code, notes, and snippets.

View incidunt's full-sized avatar

incidunt incidunt

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@incidunt
incidunt / data-analysis-about-wordpress-plugin-authors-part1.ipynb
Last active March 12, 2019 15:37
data-analysis-about-wordpress-plugin-authors-part1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@incidunt
incidunt / data-analysis-about-wordpress-plugin-authors.ipynb
Last active March 12, 2019 17:13
用python分析wordpress官网所有插件的开发者信息
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
add_action( 'genesis_entry_footer', 'genesis_exlained_post_nav' );
function genesis_exlained_post_nav() {
// 只有在添加了 genesis-explained 这个tag的文章中才执行,否则直接返回
if ( ! ( is_single() && has_tag('genesis-explained') ) ) {
return;
}
@incidunt
incidunt / ReadMe.md
Created March 3, 2019 09:44 — forked from patric-boehner/ReadMe.md
Single Post Navigation (Pagination)

#Customize and display links to previous and next post, from a single post


This snippet is for displaying and customizing the links to previous and next posts, for single post entries within the Genesis Framework.

Normally the links to the previous and next post are displayed in the entry footer as the title of the next and previous posts. I wanted to customize the function to swap the link order so that the newest article was accessible from the link on the left and the previous article was accessible form the link on the right, to better navigate posts in an ascending order. I also wanted to add the text "Previous Post" and "next Post" above the linked post titles for better clarification. See the comment in the code for more detail.

For additional customizable permeates, see the codex links under References.

@incidunt
incidunt / image-functions-examples.php
Created March 1, 2019 03:59 — forked from Lego2012/image-functions-examples.php
Image Functions examples #wordpress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
<!-- 0) Display Medium sized image floated right -->
http://sridharkatakam.com/how-to-display-featured-image-in-single-posts-in-genesis/
$image_args = array(
'size' => 'medium',
'attr' => array(
/** Remove jQuery scripts loading from header */
add_action('wp_enqueue_scripts', 'genesis_sample_script_remove_header');
function genesis_sample_script_remove_header() {
wp_deregister_script( 'jquery' );
wp_deregister_script( 'jquery-migrate' );
}
/** Load jQuery script just before closing Body tag */
add_action( 'hook', 'callback_function', 10, 1);
@incidunt
incidunt / gruber_urlintext.py
Last active November 9, 2018 05:38 — forked from uogbuji/gruber_urlintext.py
John Gruber's regex to find URLs in plain text, converted to Python/Unicode
#See: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
import re, urllib
GRUBER_URLINTEXT_PAT = re.compile(ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))')
for line in urllib.urlopen("http://daringfireball.net/misc/2010/07/url-matching-regex-test-data.text"):
print [ mgroups[0] for mgroups in GRUBER_URLINTEXT_PAT.findall(line) ]
@incidunt
incidunt / filename.applescript
Created November 3, 2018 15:05 — forked from lg0/filename.applescript
applescript:get selected filename and extension
tell application "Finder" to set theFile to POSIX path of (selection as alias)
tell application "Finder" to set fileExtension to name extension of (selection as alias)