Skip to content

Instantly share code, notes, and snippets.

@almonk
almonk / Notify.swift
Last active March 27, 2023 07:55
A little wrapper for NSNotifications with Swift
//
// Notify.swift
//
import Foundation
class Notify {
static let shared = Notify()
func send(event: NSNotification.Name) {
@almonk
almonk / SnappyWindow.swift
Last active May 2, 2024 03:05
SnappyWindow – A NSWindow that acts like the PIP Video Window from Safari
//
// SnappyWindow.swift
// A NSWindow that snaps to corners
//
// Created by Alasdair Monk on 03/02/2021.
//
import Foundation
import Cocoa
@almonk
almonk / default.json
Last active January 20, 2021 14:55
Windows Magic Keyboard mappings for PowerToys
{
"remapKeys": {
"inProcess": [
{
"originalKeys": "20",
"newRemapKeys": "27"
}
]
},
"remapShortcuts": {
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>My Sketch Library</title>
<description>My Sketch Library</description>
<image>
<url></url>
<title>My Sketch Library</title>
</image>
<generator>Sketch</generator>
@almonk
almonk / spacing.go
Created April 25, 2017 17:38
Auto specific spacing class
package main
import "fmt"
func main() {
// Padding
sum := 1
maxSize := 10
for i := 0; i < maxSize; i++ {
# SVG Squash
# Alasdair Monk
require 'Nokogiri'
puts "Creating sprite..."
svgs = Dir["./**.svg"]
contents =""
# Loop thru svgs in directory
@almonk
almonk / gist:83e9cb63a2ab3276f8a5dd79dbc7c016
Created July 3, 2016 09:11
Deploy Craft CMS to Digital Ocean
# Rename craft public/ to html/
# Add new db file locally
return array(
'*' => array(
'server' => 'localhost',
'database' => 'crafttest',
'tablePrefix' => 'craft'
),
$ npm -g install localtunnel
/usr/local/bin/lt -> /usr/local/lib/node_modules/localtunnel/bin/client
localtunnel@1.7.0 /usr/local/lib/node_modules/localtunnel
├── debug@0.7.4
├── openurl@1.1.0
├── request@2.11.4
└── yargs@3.15.0 (camelcase@1.2.1, decamelize@1.1.0, window-size@0.1.2, cliui@2.1.0)
$ lt --port 8080
your url is: https://htkzpnysxf.localtunnel.me
@almonk
almonk / menu.rb
Last active August 29, 2015 14:27
class Menu < Page
def entry?
true
end
def template
"menu_set/views/show"
end