Skip to content

Instantly share code, notes, and snippets.

View splorp's full-sized avatar
💾

Grant Hutchinson splorp

💾
View GitHub Profile
@chockenberry
chockenberry / README
Created April 6, 2022 17:32
A simple AppleScript to start up a web server in the folder where the script is located.
1) Add this code to a new file in Script Editor
2) Export the script as "Application" and make sure it's code signed
3) Put "Startup.app" in the root folder of the test website (e.g. where index.html is located)
4) Make sure that "Startup.app" has Full Disk Access in System Preferences > Security & Privacy > Privacy
@gingerbeardman
gingerbeardman / extract-and-bake-order.sh
Last active May 24, 2022 11:07
Extract a zip and bake original sort order as Finder comments and last modified date
#!/bin/bash
# by Matt Sephton @gingerbeardman
# dependencies: p7zip, pipx, osxmetadata
# $ brew install p7zip
# $ brew install pipx
# $ pipx install osxmetadata
# check your PATH and confirm operation
@scottboms
scottboms / kirby__config.php
Last active December 11, 2020 01:41
Example Kirby 3 recipe for creating a JSON Feed representation of a page with custom route
<?php
// Kirby site config file
// site/config/config.php
return [
'routes' => [
[
// This sets up two different URLs as an array that will
// return the JSON Feed representation of a page in Kirby
'pattern' => ['feed', 'some-other-path/feed'],
'action' => function() {
@frankrolf
frankrolf / arrange_stickies.scpt
Last active May 7, 2020 22:00
Applescript: distribute all stickies evenly on the main screen, with optional padding
# Distribute all stickies evenly on the main screen, with optional padding
# how many columns?
set num_columns to 7
# how many pixels of padding between the stickies?
set padding to 20
# Find the dimensions of the main screen
# https://stackoverflow.com/questions/1866912/applescript-how-to-get-current-display-resolution
@levigroker
levigroker / GitHubFlavoredMarkdown.sh
Last active February 27, 2024 23:20
A BBEdit Preview Filter script to render GitHub flavored markdown as HTML
#!/bin/bash
#
# GitHub Flavored Markdown
# https://gist.github.com/levigroker/96f96253c992b7a947d93c3d32d80b8d
#
# A BBEdit Preview Filter script to render GitHub flavored markdown as HTML
# See the "Applying Preview Filters" section of the BBEdit Manual
# https://www.barebones.com/support/bbedit/index.html#docs
# GitHub Flavored Markdown Spec: https://github.github.com/gfm/
# GitHub Flavored Markdown CLI: https://github.com/github/cmark-gfm
@jmakeig
jmakeig / clean.css
Last active May 23, 2022 18:43
BBEdit Markdown stylesheet (~/Library/Application Support/BBEdit/Preview CSS/clean.css)
body {
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-size: 12pt;
line-height: 1.45;
padding: 0 1rem;
max-width: 60em;
}
a {
color: rgba(0, 122, 255, 1);
}
anonymous
anonymous / pt100reg.py
Created August 29, 2015 04:37
PT100Reg - allows you to create a registration key for the PT100 terminal emulator for Newton
maxUnsigned = 0x1FFFFFFF
bitsInUnsigned = int(29)
seventyFivePercent = int(22)
twelvePercent = int(4)
highBits = 0x1E000000
lowBits = 0x01FFFFFF
def generateRegCode(userName):
reg = ""
sn = ""
<meta name="description" content="<?php echo $page->description()->or($site->description()) ?>">
@gollum23
gollum23 / gist:0b861de47ced51f8a50e
Last active July 6, 2019 20:24
Get last part URL with php
function uf_getLastDir($sUrl)
{
$sPath = parse_url($sUrl, PHP_URL_PATH); // parse URL and return only path component
$aPath = explode('/', trim($sPath, '/')); // remove surrounding "/" and return parts into array
end($aPath); // last element of array
if (is_dir($sPath)) // if path points to dir
return current($aPath); // return last element of array
if (is_file($sPath)) // if path points to file
return prev($aPath); // return second to last element of array
return false; // or return false
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active October 8, 2024 19:54
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /