Skip to content

Instantly share code, notes, and snippets.

View jackmcdade's full-sized avatar
🌴
🏝

Jack McDade jackmcdade

🌴
🏝
View GitHub Profile
@jackmcdade
jackmcdade / post.md
Last active August 29, 2015 14:01
A travel blog post
title author temp main_photo city clouds
Sunny Positano
jen
64
/assets/img/italy/positano/day-three/header.jpg
Positano
sunny

After an all-too-early wake up call from the boys, we glanced out the windows and lo and behold...the SUN! We jumped out of bed not wanting to miss precious seconds or the ability to see the real colors of Positano! We gobbled down a messy breakfast, scrambled a few belongings together, jammed Liam in the carrier backpack, and made the 318 stair journey down to the bus stop. Bus tickets are cheaper (1.20 € vs 1.60 €) when purchased at a tabacchini (essentially a convenience store), so we snagged a pair and we were shortly on our way down the one-way loop of Positano as the bus navigated impossible corners and tight squeezes making us look at each other with wide eyes and nervously laugh!

@jackmcdade
jackmcdade / gist:0768caa59ae15cf2888b
Created August 25, 2014 17:23
Parse out email addresses
function extractEmailAddresses($string)
{
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}
@jackmcdade
jackmcdade / mod.actually_truncate.php
Created January 16, 2015 19:05
Workaround for truncate ellipsis
<?php
/**
* Modifier_truncate
* Truncates the value of a variable
*
* @author Jack McDade
* @author Fred LeBlanc
* @author Mubashar Iqbal
*/
class Modifier_actually_truncate extends Modifier
title: Page
include:
- meta
fields:
_template:
display: Template
type: templates
header_image:
<?php
/**
* Modifier_sluggy
* Strips out comas and then replaces non-letter-characters in a variable with a separator
*/
class Modifier_more_sluggy extends Modifier
{
public function index($value, $parameters=array()) {
$separator = array_get($parameters, 0, '-');
@jackmcdade
jackmcdade / schema.json
Created May 6, 2016 17:46
Statamic v2 Import Schema
{
"taxonomies": {
"categories": ["category_one", "category_two"],
"tags": ["tag_one", "tag_two"],
"foo": ["foo_one", "foo_two"],
},
"settings": {
"site_url": "http://mysite.com",
[{"name":"organizations","color":"Green","position":{"x":97,"y":97},"increment":true,"timestamp":true,"softdelete":true,"column":[],"relation":[],"seeding":[]}]
@jackmcdade
jackmcdade / Hydratable.vue
Created August 10, 2016 20:29
Vue/Laravel Server Side Preloading
<script>
export default {
props: {
endpoint: {
type: [String, Boolean],
default: false
},
preloaded: {
type: Boolean,
default: false
server {
listen 80;
server_name example.com;
root /var/www/example.com/public/;
ssl_protocols TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
@jackmcdade
jackmcdade / feed.html
Created May 8, 2017 13:37
Statamic RSS Feed
{{ xml_header }}
<rss version="2.0">
<channel>
{{ get_content from="/blog" }}
<title>{{ title | cdata }}</title>
<link>{{ site_url }}</link>
<description>{{ content | cdata }}</description>
{{ /get_content }}
<lastBuildDate>{{ collection:blog limit="1" }}{{ date format="r" }}{{ /collection:blog }}</lastBuildDate>
<language>en-us</language>