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
@interface NSArray (MPV) | |
- (NSArray*) mpv_randomElements:(NSUInteger)maxElements; | |
@end | |
@implementation NSArray (MPV) | |
- (NSArray*) mpv_randomElements:(NSUInteger)maxElements { | |
NSUInteger numElementsToPick = MIN(self.count, maxElements); |
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 | |
install() { | |
if [ -f "$SQLITEDBPATH" ]; then | |
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup" | |
sqlite3 "$SQLITEDBPATH" <<EOF | |
INSERT INTO "tsettings" VALUES(X'189B6E28D1635F3A8325E1E002180DBA2C02C241',X'3123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022060355040B0C1B687474703A2F2F636861726C657370726F78792E636F6D2F73736C3111300F060355040A0C08584B3732204C74643111300F06035504070C084175636B6C616E643111300F06035504080C084175636B6C616E64310B3009060355040613024E5A',X'3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C21444F435459504520706C697374205055424C494320222D2F2F4170706C652F2F44544420504C49535420312E302F2F454E222022687474703A2F2F7777772E6170706C652E636F6D2F445444732F50726F70657274794C6973742D312E302E647464223E0A3C706C6973742076657273696F6E3D22312E30223E0A3C61727261792F3E0A3C2F706C6973743E0A',X'3082045E30820346A003020102020101300D06092A864886F70D01010505003081913123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E67312430 |
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
// Block based replacement for | |
// -[NSObject performSelector:withObject:afterDelay:] | |
// because I can never remember how to do it with the dispatch_after & dispatch_time functions | |
// | |
// NSObject+MPV.h | |
// iFoodler | |
// | |
// Created by Michael Vosseller on 9/26/14. |
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 | |
## Disable AppTransportSecurity in DEBUG Simulator Builds | |
if [[ ${CONFIGURATION} == "Debug" ]] && [[ $PLATFORM_NAME == *"simulator"* ]]; then | |
TARGET_INFOPLIST="${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}" | |
## Delete NSAppTransportSecurity entry if it already exists | |
/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "${TARGET_INFOPLIST}" 2>/dev/null |
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 | |
convert Icon-1024.png -resize 20x20 Icon-20.png | |
convert Icon-1024.png -resize 40x40 [email protected] | |
convert Icon-1024.png -resize 60x60 [email protected] | |
convert Icon-1024.png -resize 29x29 Icon-29.png | |
convert Icon-1024.png -resize 58x58 [email protected] | |
convert Icon-1024.png -resize 87x87 [email protected] | |
convert Icon-1024.png -resize 40x40 Icon-40.png | |
convert Icon-1024.png -resize 80x80 [email protected] | |
convert Icon-1024.png -resize 76x76 Icon-76.png |
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
protocol MyProtocol { | |
var name: String? { get } | |
} | |
extension MyProtocol { | |
var name: String? { | |
return "aDefaultName" | |
} | |
} |
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
/remind #general "Team meeting starts in 15 minutes https://meet.google.com/XXXXXXX" at 10:45AM every Monday | |
/remind #general "Team meeting starts in 5 minutes https://meet.google.com/XXXXXXX" at 10:55AM every Monday | |
/remind #general "Team meeting starts in 1 minute https://meet.google.com/XXXXXXX" at 10:59AM every Monday |
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
# add to your shell startup file (e.g. ~/.zshrc or ~/.bash_profile) | |
export FOCUS_IGNORE_SITES="twitter.com api.twitter.com www.facebook.com www.nytimes.com" | |
alias focus='sudo echo "127.0.0.1 ${FOCUS_IGNORE_SITES} # FOCUS_IGNORE_SITES" | sudo tee -a /etc/hosts > /dev/null' | |
alias unfocus="sudo sed -i '' '/FOCUS_IGNORE_SITES/d' /etc/hosts" |
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
// utility type that treats an object as "unknown but might be of type T" | |
// allows you to access each property that T has but assumes the value is `unknown | undefined` | |
// this lets you test the values of each property to determine if it is in fact a T | |
// autocomplete and refactoring the property names work | |
// you get a compiler error if you try to access a property not in T | |
type UnknownMaybe<T> = { | |
[P in keyof T]?: T[P] extends object ? UnknownMaybe<T[P]> : unknown | |
} | |
interface Message { |
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
## function to open text from stardard-input in Preview | |
## inspired by the `man-preview` function of Oh My Zsh that opens any man page in Preview https://github.com/ohmyzsh/ohmyzsh/blob/b60b3f184275c39800dd7284d6904fcf295b3956/plugins/macos/macos.plugin.zsh#L221 | |
## requires enscript: `brew install enscript` | |
## example usage: | |
## echo "hello world" | txt-preview | |
function txt-preview() { | |
enscript -q -B -p- | open -f -a Preview | |
} |
OlderNewer