Skip to content

Instantly share code, notes, and snippets.

View dannysmith's full-sized avatar

Danny Smith dannysmith

View GitHub Profile
@dannysmith
dannysmith / osx_setup.sh
Last active September 3, 2025 19:21
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@dannysmith
dannysmith / gist:02387d26d28f7ee832a879838ac830cd
Last active July 12, 2025 03:30
AI Custom Instructions for Good Writing
# Custom Instructions for Natural, High-Quality Writing
## Foundation
You are an editor and writing assistant, not a content generator. Your role is to help produce clear, natural writing that serves readers, not impresses them. Remember: good writing emerges through revision and hard thinking. Present your work as drafts that can be refined, not polished final products.
Always write in UK English (colour, organisation, realise, etc.) and prefer contractions (it's, won't, I'll) unless the context demands formality.
## Core Principles
@dannysmith
dannysmith / gist:9780920
Last active November 9, 2024 13:52
Installing Canvas LMS
# Download the source
git clone https://github.com/instructure/canvas-lms.git canvas
cd canvas
git checkout --track -b stable origin/stable
rbenv install –keep 1.9.3-p545
rbenv local 1.9.3-p545
brew install xmlsec1 postgresql
bundle install
# If you get this error: No source for ruby-1.9.3-p545 provided with debugger-ruby_core_source gem.

Intro

When building Keynote or PowerPoint presentations, I've often wanted an easy way to copy and paste from Sublime Text 3 into the slides, maintaining just the font and sytax highlighting. Thanks to the ExportHTML ST3 plugin and a bookmarklet, I now have it.

If you just want the bookmarklet, here it is...

@dannysmith
dannysmith / interviews.md
Created March 10, 2021 00:55
Lesson Plan for Interviews

Lesson: Interview Technique

Timings

This lesson should take between 60 and 90 minutes to complete, including demonstrations and exercises.

Prerequisites

None

require 'httparty'
class Medium
def self.posts(username:, limit:)
get_posts(username, limit).each do |post|
post[:published_at_as_date] = Date.strptime((post[:published_at].to_f / 1000).to_s, '%s')
end
end
class << self
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #808080 } /* Comment */
.highlight .err { color: #F00000; background-color: #F0A0A0 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #303030 } /* Operator */
.highlight .cm { color: #808080 } /* Comment.Multiline */
.highlight .cp { color: #507090 } /* Comment.Preproc */
.highlight .c1 { color: #808080 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
@dannysmith
dannysmith / wakeup.rb
Created July 21, 2017 23:21
Hue API Calls
require 'faraday'
require 'json'
require 'pry'
BRIDGE = "XXXX"
DEVICE_ID="XXXX"
puts 'Waking Danny up!'
def get(path)
url = "#{BRIDGE}/api/#{DEVICE_ID}#{path}"
article > * {
font-family: var(--font-copy);
line-height: 1.5;
max-width: 33rem;
margin-left: auto;
margin-right: auto;
}
// Natural flow margin
article > * + * {