This file contains 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
struct BlockObject { | |
Class isa; | |
int retainCount; | |
struct BlockObject *(^alloc)(); | |
struct BlockObject *(^init)(); | |
struct BlockObject *(^retain)(); | |
void (^release)(); | |
struct BlockObject *(^autorelease)(); | |
void (^dealloc)(); | |
} BlockObject = { |
This file contains 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 | |
echo -n "GitHub User: " | |
read USER | |
echo -n "GitHub Password: " | |
read -s PASS | |
echo "" | |
echo -n "GitHub Repo (e.g. foo/bar): " |
This file contains 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
osascript -e 'tell application "iOS Simulator" to quit' | |
osascript -e 'tell application "Simulator" to quit' | |
xcrun simctl erase all |
This file contains 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
# log the default values: | |
echo "speed_limit_max: `cat /proc/sys/dev/raid/speed_limit_max`" #=> 200000 | |
echo "speed_limit_min: `cat /proc/sys/dev/raid/speed_limit_min`" #=> 10000 | |
echo "stripe_cache_size: `/sys/block/md2/md/stripe_cache_size`" #=> 256 | |
# update to use more RAM (Stripe Cache Size) and higher lower bound (speed_limit_min) | |
echo 100000 > /proc/sys/dev/raid/speed_limit_min | |
# This will result in more memory usage. bumping to 32768 resulted in ~512MB RAM increase. | |
echo 32768 > /sys/block/md2/md/stripe_cache_size |
This file contains 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
#!/usr/bin/env bash | |
# Source: https://gist.github.com/fritz-c/c1e528b09bc1c0827a3c | |
# Original: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd | |
# Download this script as "git-recentco" (no extension), chmod it to be executable and put it in your | |
# path somewhere (e.g. /usr/bin). You can then use it via `git recentco` from inside any git repo. | |
# Example: | |
# |
This file contains 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
let styles: [UIFont.TextStyle] = [ | |
// iOS 17 | |
.extraLargeTitle, .extraLargeTitle2, | |
// iOS 11 | |
.largeTitle, | |
// iOS 9 | |
.title1, .title2, .title3, .callout, | |
// iOS 7 | |
.headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
] |
This file contains 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
# Carthage has no built-in way of testing if built products are already up-to-date | |
# Lets use a stampfile ourselves, so we don't have to rebuild each time if nothing changed | |
Carthage: Carthage/Build/build.stamp | |
Carthage/Build/build.stamp: Cartfile.resolved | |
-$(RM) -r Carthage/Build | |
$(CARTHAGE) bootstrap --platform iOS,watchOS | |
@touch '$@' |
This file contains 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
tell application "Deckset" | |
set doc to first document | |
set ind to 0 | |
set slideIndex of doc to ind | |
set delaySeconds to 15 | |
--set question to display dialog "Start presentation?" buttons {"OK", "Cancel"} default button 1 | |
--set answer to button returned of question | |
--if answer is equal to "OK" then |
This file contains 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
func configureDatabase() { | |
let manager = FileManager.default | |
let applicationDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) | |
let databasePath = applicationDirectory.first! + "/development.sqlite" | |
if !manager.fileExists(atPath: databasePath) { | |
manager.createFile(atPath: databasePath, contents: nil, attributes: nil) | |
} | |
let driver = try! SQLiteDriver(path: databasePath) | |
self.database = Fluent.Database(driver) | |
} |
This file contains 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
import Foundation | |
final class SafeSyncQueue { | |
struct QueueIdentity { | |
let label: String | |
} | |
let queue: DispatchQueue |
OlderNewer