Skip to content

Instantly share code, notes, and snippets.

@chrillo
chrillo / recentposts.php
Created November 29, 2011 08:08
Get recent posts from Wordpress
// include in functions.php
function get_recent_posts($num=3){
$postsQuery = new WP_Query();
$args=array(
'showposts='=> $num,
'orderby'=>'posted',
'post_type'=>'post',
//'taxonomy'=>'category', uncomment to filter posts within a category
// 'term'=>'news', e.g.: news - could be anything
);
@chrillo
chrillo / star.js
Created November 23, 2011 14:07
Draw a star in html canvas
/*
takes the x,y coordinates, the number of spikes, the inner and the outer radius of the spikes
*/
function drawStar(ctx,cx,cy,spikes,r0,r1){
var rot=Math.PI/2*3,x=cx,y=cy,step=Math.PI/spikes
ctx.strokeSyle="#000";
ctx.beginPath();