Skip to content

Instantly share code, notes, and snippets.

View lachieh's full-sized avatar

Lachlan Heywood lachieh

View GitHub Profile
@lachieh
lachieh / check-for-ghost-notifications.sh
Last active September 26, 2025 16:50
Use the `gh` CLI to check for notifications from repositories that have been deleted, then remove them
#!/bin/bash
set -euo pipefail
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
@lachieh
lachieh / md.ts
Created January 1, 2022 22:46
Markdown renderer using react-markdown and common-tags
import ReactMarkdown from 'react-markdown';
import { stripIndent } from 'common-tags';
import React, { ReactElement } from 'react';
/**
* Markdown renderer. This is a wrapper around the ReactMarkdown component.
* @param strings the strings to be formatted
* @param values the values to be inserted into the strings
* @returns A ReactMarkdown component
*/
@lachieh
lachieh / 1-react-drills-props.md
Last active January 27, 2022 19:57
React Practice

Working with Props

Friend

Create and use a component that takes a friendName prop and displays the text 'is my friend!' after the name.

Example: this should display "Bob Belcher is my friend!"

<Friend friendName="Bob Belcher" />
@lachieh
lachieh / antlers.JSON-tmLanguage
Created November 6, 2020 18:05
Antlers tmLanguage Files
{
"fileTypes": [
"antlers.html",
"html",
"htm",
"xhtml"
],
"name": "Antlers (Statamic Syntax)",
"scopeName": "text.html.statamic",
"foldingStartMarker": "{{(\\s?)",
const query = 'Queens of the Stone Age'
fetch(`https://musicbrainz.org/ws/2/artist/?query=${query}`, {
headers: {
'Accept': 'application/json'
},
})
.then(res => res.json())
.then(data => {
// search results
@lachieh
lachieh / find.sh
Created May 12, 2017 14:57
Set all files to 644 and directories to 755 in the current location
find -type f -exec chmod 644 {} \; && find -type d -exec chmod 755 {} \;
@lachieh
lachieh / head.html
Created August 23, 2016 19:00
Standard Morrison Head tags
<head>
<!-- HTML Meta -->
<title>{{title}}</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, maximum-scale=1.0, minimum-scale=1.0">
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<meta name="description" content="{{description}}">
<!-- OpenGraph Meta -->
<meta property="og:locale" content="en_US">
@lachieh
lachieh / hellotimber.zsh-theme
Created August 2, 2016 14:46
Hellotimber zsh theme
# oh-my-zsh Hellotimber Theme
# based off the 'bereau' theme
### NVM
ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b "
ZSH_THEME_NVM_PROMPT_SUFFIX=""
### Git [±master ▾●]
@lachieh
lachieh / breadcrumbs.php
Last active August 29, 2015 14:27
Create breadcrumbs to include in custom themes
// Breadcrumbs
function the_breadcrumbs() {
// Settings
$separator = '&gt;';
$breadcrumbs_id = 'breadcrumbs';
$breadcrumbs_class = 'breadcrumbs';
$home_title = 'Home';
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
@lachieh
lachieh / WP_Move_Site.sql
Created April 29, 2015 14:41
Update site URLs in a Wordpress Database by setting initial variables.
SET @oldsite = 'https://oldsite.dev'; /* Old Site URL */
SET @newsite = 'http://newsite.dev'; /* New Site URL */
SET @prefix = 'wp_'; /* Table Prefix - standard is 'wp_' */
SET @st1 = CONCAT ('UPDATE ', @prefix, 'options SET option_value = replace(option_value, \'', @oldsite, '\', \'', @newsite, '\') WHERE option_name = \'home\' OR option_name = \'siteurl\'');
PREPARE s_options FROM @st1;
EXECUTE s_options;
DEALLOCATE PREPARE s_options;
SET @st2 = CONCAT ('UPDATE ', @prefix, 'posts SET guid = replace(guid, \'', @oldsite, '\', \'', @newsite, '\')');