Skip to content

Instantly share code, notes, and snippets.

View 0xfeedface1993's full-sized avatar

John Corner 0xfeedface1993

View GitHub Profile

iPhone

Model(s) Physical Size Points (Standard) Points (Zoomed) Scale Device Resolution Screen Resolution
iPhone 15 Pro Max 6.7" 430 x 932 375 x 812 @3x 1290 x 2796 1290 x 2796
iPhone 15 Pro 6.1" 393 x 852 320 x 693 @3x 1179 x 2556 1179 x 2556
iPhone 15 Plus 6.7" 430 x 932 375 x 812 @3x 1290 x 2796 1290 x 2796
iPhone 15 6.1" 393 x 852 320 x 693 @3x device res 1179 x 2556
iPhone 14 Pro Max 6.7" 430 x 932 375 x 812 @3x 1290 x 2796 1290 x 2796
iPhone 14 Pro 6.1" 393 x 852 320 x 693 @3x 1179 x 2556 1179 x 2556
@T1T4N
T1T4N / URLSession+DataTaskProgressPublisher.swift
Last active May 2, 2023 07:39
Emulating a DataTaskPublisher with Progress
#if canImport(Combine)
import Foundation
import Combine
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension URLSession {
public typealias DataTaskProgressPublisher =
(progress: Progress, publisher: AnyPublisher<DataTaskPublisher.Output, Error>)
@Bengejd
Bengejd / Remove_unsupported_archetypes.sh
Last active August 5, 2021 09:18
XCode - Build Phase Script - Remove unsupported archetypes ( simulator x86_64 & i386) from frameworks on build.
# This removes the unsupported archetypes from frameworks on the build phase.
echo "Target architectures: $ARCHS"
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@enomoto
enomoto / swiftc_help.txt
Created June 18, 2018 20:37
$ swiftc -help
OVERVIEW: Swift compiler
USAGE: swiftc [options] <inputs>
MODES:
-dump-ast Parse and type-check input file(s) and dump AST(s)
-dump-parse Parse input file(s) and dump AST(s)
-dump-scope-maps <expanded-or-list-of-line:column>
Parse and type-check input file(s) and dump the scope map(s)
-dump-type-refinement-contexts
@saoudrizwan
saoudrizwan / TapGestureRecognizerWithoutSelector.swift
Last active March 4, 2024 06:45
Easily create tap gesture recognizers for any view using closures as actions instead of selectors.
import UIKit
extension UIView {
// In order to create computed properties for extensions, we need a key to
// store and access the stored property
fileprivate struct AssociatedObjectKeys {
static var tapGestureRecognizer = "MediaViewerAssociatedObjectKey_mediaViewer"
}
@jeffersfp
jeffersfp / fix.sh
Created September 14, 2016 19:14 — forked from icsaas/fix.sh
dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed
#!/bin/bash
set -e
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1)
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb
internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",
@emersonbroga
emersonbroga / randomWord.swift
Last active April 22, 2024 15:59
Swift Random Word Generator
//Inspired by: http://planetozh.com/blog/2012/10/generate-random-pronouceable-words/
func randomWord(wordLength: Int = 6) -> String {
let kCons = 1
let kVows = 2
var cons: [String] = [
// single consonants. Beware of Q, it"s often awkward in words
"b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
"n", "p", "r", "s", "t", "v", "w", "x", "z",
@leommoore
leommoore / file_magic_numbers.md
Last active November 17, 2024 13:25
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@ssstonebraker
ssstonebraker / sed cheatsheet
Created August 2, 2013 14:06 — forked from un33k/sed cheatsheet
Sed Cheatsheet
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'