Skip to content

Instantly share code, notes, and snippets.

View jtallant's full-sized avatar
:octocat:

Justin Tallant jtallant

:octocat:
View GitHub Profile
@jtallant
jtallant / simple-php-blog.md
Last active December 16, 2015 23:29
Simple PHP blog

I want a simple blog written in PHP

It should not have a database and it should require 0 generating (like Jekyll does). I don't want a static site generator.

Here is how I plan on showing post archives:

Store an array of posts in a global variable.

Example:

@jtallant
jtallant / wp-less-watch.php
Created February 19, 2013 19:55
Enable less.watch on WordPress site during development
<?php
add_action('wp_footer', 'less_dev_mode', 9999);
function less_dev_mode() {
?>
<script type="text/javascript">
less.env = "development";
less.watch();
</script>
<?php
@jtallant
jtallant / disable_select.js
Last active December 12, 2015 08:19
Disable select option values that are empty with jQuery. This prevents the parameter from entering the query string on form submit.
/*global jQuery document */
jQuery(document).ready(function($) {
$("form").submit(function() {
$("select").each(function () {
if ( $(this).val() === '' ) {
$(this).attr("disabled", "disabled");
}
});
return true; // ensure form still submits
@jtallant
jtallant / ai1ec-register-rewrite.php
Created January 17, 2013 18:50
All in one event calendar register_rewrite function
<?php
/**
* Register rewrite rule to enable work with pretty URIs
*/
public function register_rewrite( $rewrite_to ) {
if (
! $this->_calendar_base &&
! $this->_query_manager->rewrite_enabled()
) {
return $this;
@jtallant
jtallant / bash-prompts.md
Created December 9, 2012 20:48
Bash Prompts

PS1='\[\e[33m\]┌─[\u \w]\n\[\e[33m\]└─[\$]\[\e[0m\] '

┌─[Username ~/Repositories/Rails/sample_app]
└─[$]

@jtallant
jtallant / tweet.sh
Created October 27, 2012 20:25
Helper Function for tweeting with twurl
# Helper function for tweeting via twurl
# You must have the twurl Ruby gem installed and configured https://github.com/marcel/twurl
# This function goes in your bash profile
# Usage: tweet "This is a command line tweet"
function tweet {
twurl -q -d "status=$1" /1/statuses/update.xml
}
@jtallant
jtallant / latest-tweets-widget.php
Created October 27, 2012 18:45
Modified Genesis Latest Tweets Widget
<?php
/**
* Adds the Latest tweets widget.
*
* @category Genesis
* @package Widgets
* @author StudioPress
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://www.studiopress.com/themes/genesis
*/
@jtallant
jtallant / html5doctype.php
Created October 15, 2012 18:00
WordPress Genesis HTML5 Doctype
remove_action('genesis_doctype', 'genesis_do_doctype');
add_action('genesis_doctype', 'child_html5_doctype');
/**
* Removes the Genesis doctype and replaces it with an HTML5 doctype
*
* @author Justin Tallant
*/
function child_html5_doctype() {
$doctype = '<!DOCTYPE html>
<html dir="' . get_bloginfo("text_direction") . '" lang="' . get_bloginfo("language") . '">
@jtallant
jtallant / admin-page-show-on-filter.php
Created October 8, 2012 19:00
CMB admin page show_on filter
add_filter( 'cmb_show_on', 'agentevo_admin_show_on_filter', 10, 2 );
/**
* Admin page show_on filter
* @author Justin Tallant
* @link https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress/wiki/Adding-your-own-show_on-filters
*
* @param bool $display
* @param array $metabox
* @return bool display metabox
*/