Skip to content

Instantly share code, notes, and snippets.

View dvdsmpsn's full-sized avatar

David Simpson dvdsmpsn

View GitHub Profile
## Macro title: Responsive Gallery
## Macro has a body: N
## Body processing: n/a
## Output: HTML
##
## Developed by: David Simpson <david@appfusions.com>
## Date created: 2013-11-20
## Installed by: My Name
## @noparams
@dvdsmpsn
dvdsmpsn / gist:02c3e675f882e286fe64
Last active August 29, 2015 14:06
WordPress snippet: View location details of commenters based on their IP address - for a hover link on IP address
/**
* Add this to http://server/wp-admin/edit-comments.php
*/
<script>
function printIp(obj) {
console.log( ' +++ IP: ' + JSON.stringify(obj, null, '\t') );
}
@dvdsmpsn
dvdsmpsn / todo-confluence-user-macro.vm
Last active August 29, 2015 14:10
TODO - Confluence User Macro
## {todo}
##
## Macro name: todo
## Macro title: TODO
## Macro has a body: N
## Body processing: No macro body
## Output: Selected output option
##
## Developed by: David Simpson <david@davidsimpson.me>
## Date created: 2011-sometime
@dvdsmpsn
dvdsmpsn / String.prototype.template.js
Last active August 29, 2015 14:13 — forked from WebReflection/String.prototype.template.js
ES6 Template like strings in ES3 compatible syntax.
/**
* Usage:
* 'Hello ${name}'.template({
* name: 'chaps'
* });
*
* From: https://gist.github.com/WebReflection/8f227532143e63649804
*/
String.prototype.template = function (object) {
@dvdsmpsn
dvdsmpsn / gist:9fdf1f520ff7d9ab2cd1
Last active August 29, 2015 14:18
Helping Freddy with his mPDF problems
/**
* See: https://davidsimpson.me/2013/05/19/using-mpdf-with-codeigniter/
* and: https://twitter.com/freddysidauruk/status/586366799861563392
*/
// In `/application/library/pdf.php`:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
@dvdsmpsn
dvdsmpsn / site.pp
Created June 22, 2015 17:27
Adding CloudFoundry CLI to Boxen for Bluemix Development
## Install CloudFoundry
## brew tap pivotal/tap
homebrew::tap { 'pivotal/tap': }
## brew install cloudfoundry-cli
package { "pivotal/tap/cloudfoundry-cli":
ensure => present,
require => Homebrew::Tap['pivotal/tap'],
} ## -> installs `cloudfoundry-cli` to `/opt/boxen/homebrew/Cellar/cloudfoundry-cli/`
$hello = 'hello world';
$html = "<html><body>$hello</body></html>"; // double quotes here
$pdf = $this->pdf->load();
$pdf->WriteHTML($html);
#set( $storageHtml = $myHelper.convertStorageToView('<ac:structured-macro ac:name="info"><ac:rich-text-body><p><strong>This</strong> <em>is</em> the cheese macro: <ac:structured-macro ac:name="cheese" /></p></ac:rich-text-body></ac:structured-macro>') )
## Saving the string to a variable ending in Html is equivalent to using the @HtmlSafe annotation on the `convertStorageToView` method
<div>$storageHtml</div>
@dvdsmpsn
dvdsmpsn / global.vmd
Last active August 29, 2015 14:24
Changing the dashboard in Confluence
## ********************** NOTE: I've removed large chunks of this file, so it won't work ********************** ##
## ********************** NOTE: This is just to get the idea of where to edit ********************** ##
## **** @see https://davidsimpson.me/2014/02/27/an-alternative-to-renderconfluencemacro/#comment-188208 **** ##
## GLOBAL DECORATOR
## This decorator handles a global context, i.e. information which is independent of space.
## Supports modes: 'dashboard', 'userdir', 'rss'.
...
@dvdsmpsn
dvdsmpsn / jquery.scrollupformenu.js
Created July 21, 2015 23:14
Scroll Up For Menu with fadeIn/FadeOut instead
/**
* Project: Scroll Up For Menu
* Description: A simple mobile optimised menuing system which gets out of the way when you're not using it.
* Author: David Simpson <david@davidsimpson.me>
* License: Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>
* Source: http://github.com/dvdsmpsn/scroll-up-for-menu
*
* Usage: $('#top').scrollUpForMenu(options);
*
*