Skip to content

Instantly share code, notes, and snippets.

View invmatt's full-sized avatar

Matt Saxon invmatt

View GitHub Profile
@invmatt
invmatt / sublime.json
Created February 21, 2014 13:35
Personal user settings for Sublime Text
{
"always_show_minimap_viewport": true,
"auto_find_in_selection": true,
"bold_folder_labels": false,
"close_windows_when_empty": false,
"color_scheme": "Packages/User/GrandsonOfObsidian (SL).tmTheme",
"copy_with_empty_selection": false,
"create_window_at_startup": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"drag_text": false,
@invmatt
invmatt / gruntfile.js
Last active August 29, 2015 13:56
Concatinates sass (using compass) and outputs production (minified) and dev (expanded) files, lints the production CSS and smushes images.
/**
* Default Grunt File
* @version 0.1.0
* @description Concatinates sass and outputs production and dev, lints the production CSS, smushes images
*/
module.exports = function(grunt) {
grunt.initConfig({
@invmatt
invmatt / wp-check-sub-menu.php
Created February 8, 2014 22:52
Checks to see if the hierarchical submenu returns anything. If true output the left column else give the content a full width class.
<?php
$submenu = hierarchical_submenu($post);
if (!empty($submenu)) {
echo '
<div class="sidebar col-3-12">
'. $submenu .'
</div>
<section id="content" class="col-9-12" role="main">
';
@invmatt
invmatt / wp-remove-howdy.php
Created December 20, 2013 14:34
Remove "Howdy" from Wordpress admin bar
<?
add_filter( 'gettext', 'change_howdy_text', 10, 2 );
function change_howdy_text( $translation, $original ) {
if( 'Howdy, %1$s' == $original )
$translation = 'Logged in as %1$s';
return $translation;
}
?>
@invmatt
invmatt / match_twitter_handle.php
Last active December 30, 2015 05:49
Retrieve the JSON tweet text and replace all @username with links to profile. (using https://docs.google.com/file/d/0B6SP5Ft5Ty22SmJjSE9WOHh0RmM/edit?pli=1)
<?php
// Match Twitter handles and create a link to the profile
$string = $value["text"];
$input = preg_replace('/(?<=^|\s)@([a-z0-9_]+)/i', '<a href="http://www.twitter.com/$1">@$1</a>', $string);
echo $input;
?>
@invmatt
invmatt / quick_start.css
Last active December 29, 2015 15:29
A very basic reset, grid and layout helper, useful for rapid development / testing
/*------------------------------------*\
$RESET
\*------------------------------------*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@invmatt
invmatt / html5-starter.html
Last active December 26, 2015 17:08
Base starter html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="A description about your site" />
<meta name="keywords" content="keywords, separated, by, comma" />
<title>Untitled Document</title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="css/style.css" media="screen" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
(function($) {
$.rdCalendar = function(element, options) {
var plugin = this,
$element = $(element),
defaults = {
region : 'en',
monthNames: 'monthNamesShort',
dayNames: 'dayNamesShort',
template: '<h2><%= month %><%= year %> | <a class="navigate" href="#prev">prev</a> | <a class="navigate" href="#next">next</a></h2><table class="calendar"><thead><tr><% for (var i = 0, l = days.length; i < l; i++) { %><th><%= days[i] %></th><% } %></tr></thead><tbody><% var rows = dates.length/7, cols=7; for (var x = 0, d = 0; x < rows; x++) { %><tr><% for (var y = 0; y < cols; y++) { var date = dates[d++]; %><% if (date != null) { %><td><h3 class="day"><span class="num"><%= date.date %></span></h3><% if (date.events.length > 0) { %><ul><% for (var e = 0, l = date.events.length; e < l; e++) {%><li><a href=""><%= date.events[e].name %></a></li><% } %></ul><% } %></td><% } else { %><td></td><% } %><% } %></tr><% } %></tbody></table>',
@invmatt
invmatt / gitignore.txt
Created October 25, 2013 16:07
Base .gitignore file
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
@invmatt
invmatt / meta-slider.php
Created October 14, 2013 11:28
Metabox function for repeat_metabox.php
<?php
function iv_slider_metabox( array $meta_boxes ) {
$fields = array(
array( 'id' => 'iv-slider-title', 'name' => 'Text input field', 'type' => 'text' ),
array( 'id' => 'iv-slider-desc', 'name' => 'WYSIWYG field', 'type' => 'wysiwyg', 'options' => array( 'editor_height' => '100' ) ),
array( 'id' => 'iv-slider-img', 'name' => 'File field', 'type' => 'file', 'file_type' => 'image', 'repeatable' => 1, 'sortable' => 1 ),
);