Skip to content

Instantly share code, notes, and snippets.

View makeusabrew's full-sized avatar
💭
I may be slow to respond.

Nick Payne makeusabrew

💭
I may be slow to respond.
View GitHub Profile
@makeusabrew
makeusabrew / usage.html
Created September 23, 2012 16:12
Bootbox usage
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My page</title>
<!-- CSS dependencies -->
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
</head>
<body>
define(function() {
"use strict";
/* private shizzle */
var foo,
bar,
baz,
/* public object */
that;
@makeusabrew
makeusabrew / modal.html
Created July 2, 2012 07:07
Twitter Bootstrap - basic dialog box invocation via JavaScript (2)
<!-- set up the modal to start hidden and fade in and out -->
<div id="myModal" class="modal hide fade">
<!-- dialog contents -->
<div class="modal-body">Hello world!</div>
<!-- dialog buttons -->
<div class="modal-footer"><a href="#" class="btn primary">OK</a></div>
</div>
<!-- sometime later, probably inside your on load event callback -->
<script>
@makeusabrew
makeusabrew / folder structure.txt
Created April 11, 2012 13:53
JSON schema & template suggestion
/app/emails/templates/
- /standard-image-paragraph
- meta.json
- template.tpl
- thumbnail.png
- /header-2012-a
- meta.json
- template.tpl
- thumbnail.png
- /etc
document.write('<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>')
document.write('<div id=\"gist-1972983\" class=\"gist\">\n\n <div class=\"gist-file\">\n <div class=\"gist-data gist-syntax\">\n <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'>This is a test.<\/div><\/pre><\/div>\n <\/div>\n\n <div class=\"gist-meta\">\n <a href=\"https://gist.github.com/raw/1972983/273c1a9ffdc201dbca7d19b275bf1cbc88aaa4cb/simple-test.txt\" style=\"float:right;\">view raw<\/a>\n <a href=\"https://gist.github.com/1972983#file_simple_test.txt\" style=\"float:right;margin-right:10px;color:#666\">simple-test.txt<\/a>\n <a href=\"https://gist.github.com/1972983\">This Gist<\/a> brought to you by <a href=\"http://github.com\">GitHub<\/a>.\n <\/div>\n <\/div>\n<\/div>\n')
@makeusabrew
makeusabrew / post.tpl
Created March 4, 2012 15:09
New post template
<div class='content'>
{$post->content|gistify}
</div>
@makeusabrew
makeusabrew / post.tpl
Created March 4, 2012 15:09
Old post template
<div class='content'>
{$post->content}
</div>
@makeusabrew
makeusabrew / an-article.html
Created March 4, 2012 15:07
Normal gist embedding
<p>...blah blah blah:</p>
<script src="https://gist.github.com/1972983.js"> </script>
<p>Blah blah blah...</p>
@makeusabrew
makeusabrew / an-article.html
Created March 4, 2012 15:06
Server side embed tag
<p>...blah blah blah:</p>
[gist id=1972983]
<p>Blah blah blah...</p>
@makeusabrew
makeusabrew / modifier.gistify.php
Created March 4, 2012 14:53
Quick & dirty SSG smarty modifier
<?php
/**
* this is pretty rough and ready and is written with two implicit assumptions
* (which are fine for paynedigital.com)
*
* 1) apc_* is available
* 2) PHP >= 5.3 (anonymous callback)
*/
function smarty_modifier_gistify($text) {
$text = preg_replace_callback("@\[gist id=(\d+)\]@s", function($matches) {