Skip to content

Instantly share code, notes, and snippets.

View grantnorwood's full-sized avatar

Grant Norwood grantnorwood

View GitHub Profile
# ...
type Owner {
name: String!
email: String!
phone: String!
twitterHandle: String!
inboxNotifications: [Notification] # removed the !
}
# ...
type Owner {
name: String!
email: String!
phone: String!
twitterHandle: String # removed the !
inboxNotifications: [Notification]
}
type Query {
vacationRentalById(id: $id) : VacationRental
}
type VacationRental {
id: ID!
title: String
description: String
owner: Owner!
roomCount: Int
@grantnorwood
grantnorwood / VacationRental-initial-schema.graphql
Last active July 20, 2019 18:49
GraphQL Nullability - Initial non-nullable schema
### Initial schema
type Query {
vacationRentalById(id: $id) : VacationRental
}
type VacationRental {
id: ID!
title: String!
description: String!
# ...
type VacationRental {
id: ID!
title: String # removed the !
description: String # removed the !
owner: Owner!
roomCount: Int # removed the !
address: Address # removed the !
geolocation: GeoLocation # removed the !
@grantnorwood
grantnorwood / prompt.zsh-theme
Created November 3, 2020 02:36
Add a fancy prompt to zsh.
# Print the green/red arrow.
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
# Add the current directory & git prompt info
#
# This checks whether the path is longer then 5 elements, and in that case prints the first element (%-1~),
# some dots (/…/) and the last 3 elements. It is not exactly the same as paths that are not in your home
# directory, will also have the first element at the beginning, while bash just prints dots in that case:
#
# "%(5~|%-1~/…/%3~|%4~)"
@grantnorwood
grantnorwood / is_blog_page.php
Created August 17, 2012 17:52
WordPress' missing is_blog_page() function. Determines if the currently viewed page is one of the blog pages, including the blog home page, archive, category/tag, author, or single post pages.
<?php
/**
* WordPress' missing is_blog_page() function. Determines if the currently viewed page is
* one of the blog pages, including the blog home page, archive, category/tag, author, or single
* post pages.
*
* @see http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/query.php#L1572
*
* @return bool
@grantnorwood
grantnorwood / wp-backup.sh
Last active April 30, 2022 09:36 — forked from pacoorozco/wp-update.sh
Backup and update a Wordpress Site using wp-cli
#!/usr/bin/env bash
##########################################################################
# Shellscript : Backup and update WordPress using wp-cli
# Author : Grant Norwood <grantnorwood.com>
# Original Author : Paco Orozco <paco@pacoorozco.info>
# Requires : wp-cli
##########################################################################
# Changelog
# 20220430: 2.0
# Adds a user-specified option for forcing backup & updates