Skip to content

Instantly share code, notes, and snippets.

import EventKit
import AppKit
func requestAccess(eventStore: EKEventStore) async -> Bool {
do {
return try await eventStore.requestFullAccessToEvents()
} catch {
print("Failed to request calendar access: \(error)")
return false
}
@s-mage
s-mage / .wezterm.lua
Created December 28, 2024 13:07
~/.wezterm.lua
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.color_scheme = 'Alabaster'
config.font = wezterm.font 'Fira Code'
config.font_size = 13
config.line_height = 1.25
config.default_prog = { '/opt/homebrew/bin/bash' }
@s-mage
s-mage / userContent.css
Last active November 21, 2024 18:33
css fixes for Firefox reader mode
/*
How to apply:
* Open about:support in the address bar
* Find "Profile Folder" there, open it
* Create chrome/userContent.css file there
* Put the content of this file there
* Open about:config
* Enable toolkit.legacyUserProfileCustomizations.stylesheets
* Reload the browser
@s-mage
s-mage / hash_diff.rb
Last active April 1, 2023 16:19
Update rails translations using openAI. Usage: `OpenAITranslation.call`
class HashDiff
class << self
def t(target)
en = YAML.load_file("config/locales/en.yml")["en"]
target = YAML.load_file("config/locales/#{target}.yml")[target.to_s]
for_translation(en, target)
end
def push(target_language, update)
@s-mage
s-mage / boring-tomorrow.lua
Last active November 5, 2022 12:36
A colorscheme that only highlights things that require attention. https://smagin.fyi/posts/colorscheme/
vim.o.background = "light"
vim.o.termguicolors = true
if vim.g.colors_name then vim.cmd("hi clear") end
vim.cmd("syntax reset")
vim.g.colors_name = "Boring Tomorrow"
-- Default GUI Colours
@s-mage
s-mage / prepare-commit-msg
Last active November 20, 2024 16:33
.git/hooks/prepare-commit-msg
#!/bin/bash
# usage:
# mkdir ~/.githooks
# nvim ~/.githooks/prepare-commit-msg # paste the content of this file
# git config --global core.hooksPath ~/.githooks/ # you don't have to do it globally but
COMMIT_MSG_FILE=$1
branch="$(git rev-parse --abbrev-ref HEAD)"
chromedriver
firefox
iterm2
karabiner-elements
skype
steam
thunderbird
virtualbox
anki
djview
FF = "Firefox"
CHROME = "Google Chrome"
SLACK = "com.tinyspeck.slackmacgap"
GLEAM_GH = /github.com\/Crowd9/
module.exports = {
defaultBrowser: FF,
handlers: [
@s-mage
s-mage / convert.sh
Last active February 14, 2018 15:00
Imagemagick tricks
# change white to transparent
convert old.png -fuzz 20% -transparent white new.png
@s-mage
s-mage / test_vcr_re_record_log
Last active August 30, 2017 11:29
[Log] VCR ignores cached responses after first re-record
# re_record_time: 10.minutes
# Time: 11:57
# VCR records requests first time
$ bundle exec rspec ./spec/features/market/job_offer_spec.rb
Job Offer
to a hourly job
company
VCR GET: https://api.stripe.com/v1/customers/cus_BJ3toXQ39RNwHm