Skip to content

Instantly share code, notes, and snippets.

View blakewatson's full-sized avatar
🍟
Converting fries into websites

Blake Watson blakewatson

🍟
Converting fries into websites
View GitHub Profile
@blakewatson
blakewatson / Set microphone.scpt
Last active July 18, 2023 16:37
AppleScript for setting specified audio input device
do shell script "open x-apple.systempreferences:com.apple.Sound-Settings.extension"
delay 1
tell application "System Events" to tell process "System Settings"
tell table 1 of scroll area 1 of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Sound"
select (row 1 where value of static text 1 of group 1 of UI element 1 is "YOUR MICROPHONE NAME HERE")
end tell
end tell
delay 1
tell application "System Settings" to quit
@blakewatson
blakewatson / spacing.css
Last active December 27, 2022 17:54
Customizable utility classes for applying margin and padding
:root {
--xxs: 0.125rem;
--xs: 0.25rem;
--sm: 0.5rem;
--md: 1rem;
--lg: 2rem;
--xl: 4rem;
--xxl: 8rem;
}
/**
* Assign an ID to an object. Will make sure the ID doesn't already exist.
* @param {object} entity Object to which to assign an ID
* @param {array} list list of existing entities
* @returns {object}
*/
export const assignRandomId = (entity, list) => {
const idExists = (id) => list.some((entity) => entity.id === id);
do {
@blakewatson
blakewatson / hacker-news-dark.css
Last active January 18, 2021 06:06
Hacker News Dark
@namespace url(http://www.w3.org/1999/xhtml);
body {
background-color: #262626 !important;
}
body > center > table, input, textarea {
background-color: #222 !important;
}
body > center > table > tbody > tr:first-child > td {
@blakewatson
blakewatson / keybindings.json
Last active December 16, 2020 18:09
Visual Studio Code - User Settings & Key Bindings
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+a",
"command": "-editor.action.blockComment",
@blakewatson
blakewatson / simplenote.css
Last active July 31, 2020 04:47
Some custom styles for the Simplenote web interface
/* Increase the font size of the first line of a note. */
.note-detail [data-block]:first-of-type {
line-height: 1.5em;
font-size: 1.5em;
}
/* Style the note list scrollbar (in dark mode) in Firefox */
.theme-dark .note-list {
scrollbar-color: rgba(255, 255, 255, 0.5) transparent;
}
@blakewatson
blakewatson / dom.js
Last active April 30, 2017 14:14
A tiny wrapper around native DOM API functions. Designed to help me select elements more easily.
var dom = (selector, el = null) => {
if(el) {
return Array.from(el.querySelectorAll(selector));
} else {
return Array.from(document.querySelectorAll(selector));
}
};
dom.first = (selector, el = null) => {
if(el) {
@blakewatson
blakewatson / Preferences.sublime-settings
Created April 27, 2017 14:50
My Sublime Text 3 settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_bottom": 1,
"caret_extra_top": 0,
"caret_extra_width": 0,
"caret_style": "smooth",
"color_scheme": "Packages/User/blake-eighties.tmTheme",
"enable_tab_scrolling": false,
"font_face": "Operator Mono",
@blakewatson
blakewatson / bw-eighties.tmTheme
Created February 3, 2017 19:55
An adaptation of https://github.com/kkga/spacegray/blob/master/base16-eighties.dark.tmTheme with comments in italics (really nice if you use Operator Mono as your font).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Template: Chris Kempson, Scheme: Chris Kempson (http://chriskempson.com)</string>
<key>name</key>
<string>Base16 Eighties Dark</string>
<key>semanticClass</key>
<string>base16.eighties.dark</string>
@blakewatson
blakewatson / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console