Skip to content

Instantly share code, notes, and snippets.

@steipete
steipete / UIWindow+PSPDFAdditions.h
Last active June 5, 2024 20:09
Mac Catalyst: Get the NSWindow from a UIWindow (Updated for macOS 11 Big Sur, also works with Catalina)
// Don't forget to prefix your category!
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIWindow (PSPDFAdditions)
#if TARGET_OS_UIKITFORMAC
---
format_version: 1.1.0
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- BITRISE_PROJECT_PATH: XXXX.xcworkspace
opts:
is_expand: false
- BITRISE_SCHEME: XXXX.xcworkspace
opts:
@aallan
aallan / object_detection_with_labels.py
Created March 8, 2019 19:54
Object detection python demonstration code for use with Google's Edge TPU (now with labelling)
import argparse
import platform
import subprocess
from edgetpu.detection.engine import DetectionEngine
from PIL import Image
from PIL import ImageFont, ImageDraw
# Function to draw a rectangle with width > 1
def draw_rectangle(draw, coordinates, color, width=1):
for i in range(width):
@keith
keith / exclusivity.md
Last active January 11, 2025 03:47
The matrix of Xcode build settings to compiler flags for Swift memory exclusivity
  • Compiler flag: -enforce-exclusivity=<value>
  • Build setting: SWIFT_ENFORCE_EXCLUSIVE_ACCESS

Xcode 10.1 & Swift 4.2

  • Compiler default for non optimized builds if you pass no argument is the same as if you passed checked
  • Compiler default for optimized builds if you pass no argument is the same as if you passed unchecked
Configuration Compiler Flag Value Build Setting Description Build Setting Value Notes
@drumnkyle
drumnkyle / cleanup_files.sh
Created December 10, 2018 18:57
OCLint Scripts
#!/bin/bash
rm "compile_commands.json"
rm "xcodebuild.log"
@hanhdt
hanhdt / 03_elastic_beanstalk_nginx.config
Last active March 31, 2021 18:41
Overwriting Nginx config on AWS Elastic Beanstalk
files:
"/etc/nginx/conf.d/01_app_server.conf":
mode: "000644"
owner: root
group: root
content: |
# The content of this file is based on the content of /etc/nginx/conf.d/webapp_healthd.conf
upstream website_upstream {
server unix:///var/run/puma/my_app.sock;
}
@christophmeissner
christophmeissner / oclint.yaml
Created January 12, 2018 13:06
Default OCLint rule configuration file
################################################################################
# #
# Sample OCLint configuration file with current (v0.13) default values. #
# #
# Place this file in the directory you invoke oclint from and rename it #
# to '.oclint' #
# #
# See http://oclint-docs.readthedocs.io/en/stable/howto/rcfile.html #
# #
################################################################################
@yanhsiah
yanhsiah / mutex
Created December 18, 2017 02:53
mutex lock example for objective-C
- (void)sampleMethod
{
NSOperationQueue *operationQueue = [NSOperationQueue new];
MockService *service = [MockService sharedService];
[operationQueue addOperationWithBlock:^{
NSString *key = @"url_1";
[service runServiceByKey:key];
}];
[operationQueue addOperationWithBlock:^{
@christopheranderton
christopheranderton / update-outdated-brew-casks.sh
Last active March 17, 2025 14:04
Upgrade outdated brew casks. One liner, and the ”official” way to do it without using different hacks or scripts. However, it does not really replace some scripts out there, as in-app updates is not seen by Homebrew.
# Upgrade / Update outdated casks installed.
# --------------------------------------------------------------------------------
# Looks for outdated casks and installs the the latest version.
# User data (like application preferences) is intact.
# Updated one liner (thanks Henrik242)
# --------------------------------------------------------------------------------
brew upgrade $(brew outdated --cask --greedy --quiet)
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 28, 2025 07:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example