Skip to content

Instantly share code, notes, and snippets.

View grantnorwood's full-sized avatar

Grant Norwood grantnorwood

View GitHub Profile
@grantnorwood
grantnorwood / url_encode.cpp
Created August 8, 2023 04:59
Encode & decode strings for URLs in C++
/**
* Decode a URL-encoded string.
*/
String urlDecode(String str)
{
String encodedString = "";
char c;
char code0;
char code1;
for (int i = 0; i < str.length(); i++)
@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
@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~)"
# ...
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 !
type Query {
vacationRentalById(id: $id) : VacationRental
}
type VacationRental {
id: ID!
title: String
description: String
owner: Owner!
roomCount: Int
# ...
type Owner {
name: String!
email: String!
phone: String!
twitterHandle: String # removed the !
inboxNotifications: [Notification]
}
# ...
type Owner {
name: String!
email: String!
phone: String!
twitterHandle: String!
inboxNotifications: [Notification] # removed the !
}
@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!