Skip to content

Instantly share code, notes, and snippets.

View ancillaryfactory's full-sized avatar

Jon Schwab ancillaryfactory

View GitHub Profile
@ancillaryfactory
ancillaryfactory / refresh_css.php
Created January 8, 2012 03:23
Force browser to refresh outdated CSS files
<link rel="stylesheet" href="css/style.css?<?php echo filemtime('css/style.css');?>">
@ancillaryfactory
ancillaryfactory / image-shortcode.php
Created March 7, 2012 01:16 — forked from kovshenin/image-shortcode.php
WordPress: Image shortcode for WordPress
<?php
/**
* Image shortcode callback
*
* Enables the [kovshenin_image] shortcode, pseudo-TimThumb but creates resized and cropped image files
* from existing media library entries. Usage:
* [kovshenin_image src="http://example.org/wp-content/uploads/2012/03/image.png" width="100" height="100"]
*
* @uses image_make_intermediate_size
*/
@ancillaryfactory
ancillaryfactory / .gitignore
Created March 7, 2012 01:24 — forked from redoPop/.gitignore
Wordpress: Template .gitignore file
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@ancillaryfactory
ancillaryfactory / gist:1990297
Created March 7, 2012 01:29 — forked from elebescond/gist:1336580
Wordpress: Register admin options
<?php
add_action( 'admin_init', 'myplugin_admin_init' );
function myplugin_admin_init() {
//register settings
register_setting( 'myplugin_options_group1', 'myplugin_option_1' );
}
// create custom plugin settings menu
@ancillaryfactory
ancillaryfactory / gist:2033357
Created March 14, 2012 02:02 — forked from luetkemj/wp-query-ref.php
Wordpress: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@ancillaryfactory
ancillaryfactory / addWidget.php
Created March 15, 2012 10:23 — forked from tiffyzsmile/addWidget.php
Wordpress: Add widget area
How to add a widget area to your theme.
<div id="sidebar">
<ul>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) : ?>
<li><!-- stuff shown here in case no widgets active --></li>
<?php endif; ?>
</ul>
</div>
@ancillaryfactory
ancillaryfactory / wordpress-subpages-menu.php
Created March 15, 2012 10:27 — forked from wvega/wordpress-subpages-menu.php
Wordpress: Add a subpages menu
<?php
function subpages() {
global $post;
// Output a link to the parent page, if we are on a subpage
if (!empty($post->post_parent)) {
$title = esc_attr(get_the_title($post->post_parent)) ?>
<p><b>Parent page:</b><br />
<a href="<?php echo get_permalink($post->post_parent); ?>" title="<?php echo esc_attr($title); ?>"><?php echo $title ?></a></p>
@ancillaryfactory
ancillaryfactory / Contract Killer 3.md
Created November 11, 2012 03:32 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
import os, sys, argparse, string
from pelican import __version__
TEMPLATES={
'Makefile' : '''
PELICAN=$pelican
PELICANOPTS=$pelicanopts
@ancillaryfactory
ancillaryfactory / new_post.py
Last active December 11, 2015 01:58
Utility to build new Pelican posts from the command line. Add new_post.py to the root Pelican directory and add the two lines below to Makefile. Type `make post` to run the script. NOTE: After the new post file is created, it's automatically opened in the text editor of your choice. I used Sublime Text in a Windows environment as the example.
post:
@python $(BASEDIR)/new_post.py "$(INPUTDIR)"