Skip to content

Instantly share code, notes, and snippets.

View dcorking's full-sized avatar

David Corking dcorking

View GitHub Profile

🚀 Controlling Cache on GitHub Pages for Vanilla HTML & CSS

🔍 Understanding GitHub Pages Caching

GitHub Pages aggressively caches static files (HTML, CSS, JS), which can sometimes prevent updates from appearing immediately. Since GitHub does not support .htaccess for direct cache control, you must use alternative methods.

📝 1. Do You Need a .nojekyll File?

  • No, if you did not enable Jekyll when setting up GitHub Pages.
  • Yes, if your repository contains _config.yml, _layouts/, _includes/, or _posts/, as GitHub Pages will assume it's a Jekyll site.
  • 📂 Creating a .nojekyll file in your repo prevents GitHub from processing files as a Jekyll site but is unnecessary for pure HTML/CSS sites.

Ruby: The future of frozen string literals

What is a literal?

In programming languages, literals are textual representations of values in the source code. This is a syntactical concept.

Some examples:

7 # integer literal
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@johndturn
johndturn / launchd-for-services.md
Last active December 27, 2025 05:06
Overview of using launchd to set up services on a macOS machine.

launchd - Script Management in macOS

What is it?

  • Used on macOS for managing agents and daemons and can be used to run scripts at specified intervals
    • macOS's competitor to cron, along with other things
  • Runs Daemons and Agents

What is a Daemon?

@yahonda
yahonda / ruby31onrails.md
Last active June 8, 2025 17:51
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@julianhyde
julianhyde / scott-sql-fiddle-postgresql.sql
Created November 2, 2020 06:52
Script to create the "SCOTT" schema (tables EMP, DEPT, BONUS, SALGRADE, DUMMY), in a format suitable for pasting into SQL Fiddle for PostgreSQL
-- Script to create Oracle's "SCOTT" schema with tables
-- EMP, DEPT, BONUS, SALGRADE, DUMMY. Originally Oracle's demobld.sql.
--
-- In a format suitable for pasting into SQL Fiddle for PostgreSQL:
-- http://sqlfiddle.com/#!17
create table dept(
deptno decimal(2,0) not null,
dname varchar(14),
loc varchar(13));
create table emp(
@stevedodson
stevedodson / README.md
Last active June 17, 2025 09:07
Introduction to supervised machine learning in Elastic webinar - Tuesday, February 25, 2020

Introduction to supervised machine learning in Elastic webinar

Tuesday, February 25, 2020

Wednesday, May 27, 2020 - updated customer_churn.ipynb for version 7.7.0

Monday, November 16, 2020 - updated for version 7.10 and eland 7.10b

Monday, September 20, 2021 - updated customer_churn.ipynb for version 7.14

Monday, February 8, 2022 - updated customer_churn.ipynb for version 8.0

@dcorking
dcorking / authentication_spec.rb
Created January 9, 2020 17:20
testing a doorkeeper token request via a password grant
require 'rails_helper'
RSpec.describe '/oauth/', type: :request do
let(:application) { create(:doorkeeper_application, confidential: false) }
let(:user) { create(:user, email: 'joe@example.com', password: "PASSWORD") }
let(:valid_params) do
{
username: user.email,
password: "PASSWORD",
grant_type: 'password',
@dcorking
dcorking / demo_option_parser.rb
Created December 23, 2019 12:26
lightweight-ish option parsing with Ruby standard library
# run with
# ruby tools/demo-option-parser.rb --skip-download
# or
# bundle exec rails runner tools/demo-option-parser.rb --skip-download
require 'optparse' # not needed for rails runner
skip = nil
p ARGV # ["--skip-download"]
@dcorking
dcorking / footer_helper.rb
Last active November 15, 2019 17:00
year, or range of years with en dash if needed - for example for copyright messages