Skip to content

Instantly share code, notes, and snippets.

View jackmcdade's full-sized avatar
🌴
🏝

Jack McDade jackmcdade

🌴
🏝
View GitHub Profile
title: Big Healthy Green
ingredients:
- 6 to 8 kale leaves
- 2 to 4 stalks of celerey
- 3 to 4 carrots
- 2 apples
- 1 medium-sized cucumber
- 1 beet
- 1/2 lemon
directions: >
@jackmcdade
jackmcdade / gist:3138277
Created July 18, 2012 19:27
Add trailing slashes
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
@jackmcdade
jackmcdade / gist:3186283
Created July 27, 2012 05:17
Adding .html to the end of URLS
// Add the following after line 8 of _app/_routes.php
if (substr($path, -5) == '.html') {
$path = str_replace('.html', '', $path);
}
And use the following .htaccess rule before your index.php rewrite:
RewriteRule ^([^.]+)$ /$1.html [R=301,L]
@jackmcdade
jackmcdade / gist:3209202
Created July 30, 2012 19:03
Bad PHP Example
<?php
// Bad
$name = (!empty($_GET['name'])? $_GET['name'] : 'John');
// Good
// Some basic sanitization. Make sure to clean further if inserting into database
$name = (!empty($_GET['name'])? $_GET['name'] : 'John');
$name = strip_tags($name);
$name = htmlspecialchars($name, ENT_QUOTES);
@jackmcdade
jackmcdade / gist:3484008
Created August 26, 2012 22:44
Bash - archive to desktop
function zipit {
local filename=$1
if [ -z "$filename" ] ; then
filename=${PWD##*/}"-latest"
fi
git archive HEAD --format=zip > ~/Desktop/${filename}.zip
}
@jackmcdade
jackmcdade / gist:3518861
Created August 29, 2012 20:58
Grid example
{{ the_grid }}
<div class="row">
<h1>{{ caption }}</h1>
<p>{{ some_text }}</p>
</div>
{{ /the_grid }}
@jackmcdade
jackmcdade / statamic-iis
Created October 10, 2012 17:17 — forked from PendragonDevelopment/statamic-iis
Statamic IIS rewrite rules for web.config
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(_config)" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(.*).yml$" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
@jackmcdade
jackmcdade / statamic-iis
Created October 10, 2012 17:17 — forked from PendragonDevelopment/statamic-iis
Statamic IIS rewrite rules for web.config
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(_app)" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(_cache)" ignoreCase="false" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<h6 class="center">The Latest from <a href="/blog">My Journal</a></h6>
{{ entries:listing folder="blog" limit="5" }}
<div class="block entry">
<header>
<h2 class="entry-title"><a href="{{ url }}">{{ title }}</a></h2>
<p class="entry-date"> {{ datestamp format="F jS, Y" }}</p>
</header>
{{ content|widont }}
@jackmcdade
jackmcdade / index.html
Last active December 13, 2015 17:28 — forked from darwin/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg);">
<scene id="scene1">
<label t="translate(0,346)">