To have a gulp workflow that with a single process,
- watches for any sass changes, then compiles sass source into css
- watches for any changes in the public directory, triggers live-reload
- serves your static content in
public/
add_filter( 'the_content', 'post_love_display', 99 ); | |
function post_love_display( $content ) { | |
$love_text = ''; | |
if ( is_single() ) { | |
$love = get_post_meta( get_the_ID(), 'post_love', true ); | |
$love = ( empty( $love ) ) ? 0 : $love; | |
$love_text = '<p class="love-received"><a class="love-button" href="#" data-id="' . get_the_ID() . '">give love</a><span id="love-count">' . $love . '</span></p>'; |
git log --all --numstat --pretty="%H" --author="author" --since=1.year | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}' |
<?php | |
/** | |
* Custom WordImpress RSS2 Feed | |
* Integrates Featured Image as "Enclosure" | |
* See http://www.rssboard.org/rss-2-0-1#ltenclosuregtSubelementOfLtitemgt | |
* for RSS 2.0 specs | |
* @package WordPress | |
*/ | |
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); |
<?php | |
/** | |
* handle the calculation | |
* @param integer $seconds [description] | |
* @return [type] [description] | |
*/ | |
function rkv_calc_read_time( $seconds = 0 ) { | |
// calc the minutes |
These are my notes basically. At first i created this gist just as a reminder for myself. But feel free to use this for your project as a starting point. If you have questions you can find me on twitter @thomasf https://twitter.com/thomasf This is how i used it on a Debian Wheezy testing (https://www.debian.org/releases/testing/)
Discuss, ask questions, etc. here https://news.ycombinator.com/item?id=7445545
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
var eventTimeout; // Set timeout variable | |
/** | |
* The function that runs the event actions | |
*/ | |
var actualEventHandler = function () { | |
// handle the event... | |
}; | |
/** |
#progresswrapper { | |
position: fixed; | |
top: 0px; | |
height: 2px; | |
width: 100%; | |
z-index: 1000; | |
} | |
#progressbar { | |
top: 0; | |
position: fixed; |
$pdf_file = './pdf/demo.pdf'; | |
$save_to = './jpg/demo.jpg'; //make sure that apache has permissions to write in this folder! (common problem) | |
//execute ImageMagick command 'convert' and convert PDF to JPG with applied settings | |
exec('convert "'.$pdf_file.'" -colorspace RGB -resize 800 "'.$save_to.'"', $output, $return_var); | |
if($return_var == 0) { //if exec successfuly converted pdf to jpg | |
print "Conversion OK"; | |
} |