This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This makes OS X treat numpad 1-9 as if NumLock is off. | |
# Reference: https://developer.apple.com/library/archive/technotes/tn2450/_index.html | |
hidutil property --set '{"UserKeyMapping":[ | |
{"HIDKeyboardModifierMappingSrc":0x700000059,"HIDKeyboardModifierMappingDst":0x70000004D}, | |
{"HIDKeyboardModifierMappingSrc":0x70000005A,"HIDKeyboardModifierMappingDst":0x700000051}, | |
{"HIDKeyboardModifierMappingSrc":0x70000005B,"HIDKeyboardModifierMappingDst":0x70000004E}, | |
{"HIDKeyboardModifierMappingSrc":0x70000005C,"HIDKeyboardModifierMappingDst":0x700000050}, | |
{"HIDKeyboardModifierMappingSrc":0x70000005E,"HIDKeyboardModifierMappingDst":0x70000004F}, | |
{"HIDKeyboardModifierMappingSrc":0x70000005F,"HIDKeyboardModifierMappingDst":0x70000004A}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"prettier": { | |
"useTabs": true, | |
"semi": false, | |
"singleQuote": false, | |
"bracketSpacing": true, | |
"trailingComma": "es5", | |
"printWidth": 160 | |
}, | |
"eslintConfig": { | |
"parserOptions": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>GroupName</key> | |
<string>_www</string> | |
<key>InitGroups</key> | |
<true/> | |
<key>KeepAlive</key> | |
<true/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The intent of this script is to search for photos you've tagged and create optimized versions | |
# of them in a particular folder (with subfolders for each tag). You can then set iTunes to sync | |
# your phone's Photos app to this folder, allowing you to easily carry around some albums | |
# (separate from your camera roll, Photostream, or other cloud folders). I created this as a way | |
# to ensure that both my phone and my wife's have consistent, offline copies of our favorite family | |
# photos. We use different Mac computers but have a shared drive with family photos, so I needed a | |
# solution that allows either of us to flag photos. Once set up, adding photos to your phone is as | |
# simple as adding a tag to the photo in Finder and re-running the script (which can be set to run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Encodes a positive integer (or 0) in Base 2^14, using the Unicode CJK Unified Ideographs block as digits. | |
// This is a silly thing to do, but has a particular use case. | |
// Blog post here: http://blog.tallent.us/?p=368 | |
public static int FromBase16384(this string value) { | |
if(string.IsNullOrEmpty(value)) throw new ArgumentException(); | |
int letter; | |
int letterBase = 1; | |
int iout = 0; | |
for(var x = 0; x < value.Length; x++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' This is a quick VBA function to validate CAS Registry Numbers for length and checksum. | |
' It does not check the location of the dashes, and will fail if non-digits are included. | |
' Spaces are ignored. Blanks can either be allowed or not, depending on your use case. | |
' https://en.wikipedia.org/wiki/CAS_Registry_Number | |
' Usage: Debug.Print ValidateCAS("7732-18-5") | |
Public Function ValidateCASRN(ByVal CAS As String, Optional ByVal allowBlank As Boolean = False) As Boolean | |
Application.Volatile False | |
Dim numDigits As Integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace RT { | |
/// <summary> | |
/// Generic, yet more expressive mechanism for returning both a value and a status from a function. | |
/// Nothing earth-shattering, just syntactic sugar and logic to create an immutable struct with | |
/// minimal effort. | |
/// | |
/// Usage: | |
/// return Result<foo>.Succeeded(myFoo); // returned foo is good | |
/// return Result<foo>.Failed(); // unsuccessful, no foo to return |