Skip to content

Instantly share code, notes, and snippets.

View scottgruber's full-sized avatar

Scott Gruber scottgruber

View GitHub Profile
@scottgruber
scottgruber / export_blog.php
Created February 16, 2019 20:26
Export Perch Runway blog to import to a Perch Runway article collection
<?php
//include('../perch/runtime.php');
$site_url = 'https://'.$_SERVER['HTTP_HOST'];
$feed = [
//'version' => 'https://jsonfeed.org/version/1',
//'title' => 'Scott Gruber\'s website',
//'home_page_url' => $site_url,
//'feed_url' => $site_url.'/blog/json-export.php',
@scottgruber
scottgruber / home.php
Created December 24, 2017 18:16
Travel fans
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>suefan.art Travel Fans</title>
<meta name="description" content="An interactive map of everywhere the Fan family traveled this year.">
<meta name="author" content="Lauren Hallden">
/** Gulp tasks.
1. lint scss files
2. compile sass
Development: Linting, Sourcemaps, Autoprefixing, Watch
Production: Linting, Autoprefixing, Optimisation (Sorting, removing duplicates etc.), Minification
// https://github.com/slushie-js/slushie
/**
* Linting Sass stylesheets with Stylelint
* http://www.creativenightly.com/2016/02/How-to-lint-your-css-with-stylelint/
@scottgruber
scottgruber / cards-hardboiled.config.js
Created April 18, 2017 04:23
Fractal Component Using data from an API
// cards-hardboiled.config.js
'use strict';
const request = require('request-promise'); // require the request-promise module
// make the request to the API, returns a Promise
const response = request({
uri: 'https://scottgruber.me/api/hardboiled',
json: true
});
@scottgruber
scottgruber / Readme.md
Last active March 31, 2017 16:35
Using PerchSystem class to conditionally load MailChimp subscribe form when visitor is not on home page

Two methods using PerchSystem::get_var to test if user is on home page.

If user is not on home page, then load MailChimp subscribe form.

Use Case

I have a subscribe to my email newsletter component in the middle of my home page. I also include the subscribe component in the footer of each page. The conditionally test lets me load the subscribe component only when users are not on the home page thereby avoiding the duplication. I'm taking advantage of PerchSystem class which holds a number of utility methods to make it easier to quickly code a solution. I'm posting this note to document my use cases and learning notes PerchSystem.

Links

@scottgruber
scottgruber / readme.md
Last active May 7, 2021 21:57 — forked from remy/batcharge.py
My zsh set up as of August 9, 2019

Setup zsh

Based on Remy Sharp's most excellent Working the Command Line

brew install zsh zsh-completions

Add oh-my-zsh

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

Make zsh default shell

@scottgruber
scottgruber / .gitignore
Last active August 10, 2019 02:02 — forked from octocat/.gitignore
My global .gitignore configuration
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@scottgruber
scottgruber / data.json
Last active March 7, 2019 10:24
PHP script to import a JSON data source into a Perch Runway content collection
{
"data": [
{
"id": 14832,
"Title": "First story title",
"Content": "postBody. Long body of markdown or html removed for this example",
"Date": "2017-01-13",
"Permalink": "first-story-title",
"author_given_name": "Scott",
"author_family_name": "Gruber"
@scottgruber
scottgruber / .htaccess
Created October 28, 2016 21:42 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@scottgruber
scottgruber / links-screenshot.png
Last active September 27, 2023 22:39
Build nav links with Perch pagelist addon and repeater