Skip to content

Instantly share code, notes, and snippets.

View streetturtle's full-sized avatar
:octocat:
Build software people love

streetturtle

:octocat:
Build software people love
View GitHub Profile
@streetturtle
streetturtle / NSColorExtensions.swift
Last active December 24, 2021 01:39
Useful NSColorExtensions
extension NSColor {
/// NSColor initializer accepting hex color string
///
/// ```
/// NSColor(hex: "#BADA55")
/// ```
///
/// - Parameter hex: Hex color string, may include a hash (#) prefix
/// - Returns: an NSColor of given hex color string
@streetturtle
streetturtle / DateExtensions.swift
Last active December 24, 2021 02:02
Date Extensions
extension Date {
func getElapsedInterval() -> String {
let interval = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: Date())
if let year = interval.year, year > 0 {
return "\(year) year\(year == 1 ? "" : "s") ago"
} else if let month = interval.month, month > 0 {
return "\(month) month\(month == 1 ? "" : "s") ago"
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.org (or in your downloaded distribution).
@streetturtle
streetturtle / init.lua
Created February 17, 2023 15:01
Hammerspoon snippet to manipulate window position/size with a shortcut
-- GRID
-- hs.window.animationDuration=0.1;
local hotkey = require "hs.hotkey"
local grid = require "hs.grid"
grid.MARGINX = 0
grid.MARGINY = 0
grid.GRIDHEIGHT = 3
grid.GRIDWIDTH = 3