Skip to content

Instantly share code, notes, and snippets.

View mattheu's full-sized avatar

Matthew Haines-Young mattheu

View GitHub Profile
@westonruter
westonruter / example.php
Last active April 2, 2016 17:55
Some code we're using at XWP to make plugins easier and cleaner to write.
<?php
require_once __DIR__ . '/pluginception.php'
class ShoutPlugin {
use Pluginception;
function __construct() {
/*
* This method comes from the Pluginception trait,
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
@danielbachhuber
danielbachhuber / gist:6691084
Last active September 5, 2024 01:43
Auto-paginate after 500 words, but respect paragraphs and don't leave page stubs.
<?php
/**
* Auto-paginate after 500 words
*/
add_action( 'loop_start', function( $query ) {
if ( ! is_single() || 'post' != get_post_type() || ! $query->is_main_query() )
return;
$content = $query->posts[0]->post_content;
@UtahDave
UtahDave / saltsample_09252012_01
Created September 26, 2012 02:54 — forked from l2ol33rt/saltsample_09252012_01
Saltstack sample of using states and pillars for users
Here is a sample of how I am currently dealing with users.
Big thanks to uggedal! I used his user states as an example: https://github.com/uggedal/states
###
# How to create password hashes
###
python -c "import crypt; print crypt.crypt('password', '\$6\$SALTsalt\$')"
###
@jfsiii
jfsiii / gimmmeauth.js
Created December 24, 2011 19:51
authorize using GimmieBar API
console.log('get REQUEST token', clientId, clientSecret);
gimmeOauth.getRequestToken(clientId, clientSecret, function(error, token){
if (error) {
console.error(error);
} else {
console.log('got REQUEST token', token);
console.log('get ACCESS token', clientId, token);
gimmeOauth.getAccessToken(clientId, token, function(error, data) {
if (error) console.error(error);
else {
@willmot
willmot / gist:1277790
Created October 11, 2011 10:33
WordPress attachment category plugin
<?php
/*
Plugin Name: Attachment Categories
Description: Allows attachments to be categorised
Version: 1.0
Author: Human Made Limited
Author URI: http://hmn.md
*/
@artero
artero / launch_sublime_from_terminal.markdown
Last active September 12, 2024 02:13 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@joehoyle
joehoyle / WPPost.php
Created July 26, 2011 17:15
An Idea for a WordPress Post class
<?php
/**
* This is a take on making the Post object in WordPress a little more object-y. As well as wrapping
* some basic function like get_the_title(), it aims to treat references such as "post_parent"
* as full objects rather than IDs, making it possible to do $post->get_parent()->get_content().
*
* No caching has been added, but this would be trivial. Half written in pseudo-code and untested
*
*/
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>