Skip to content

Instantly share code, notes, and snippets.

View Josscii's full-sized avatar
💭
??

Josscii Josscii

💭
??
View GitHub Profile
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active March 19, 2025 07:02
The best FRP iOS resources.

Videos

Git Cheat Sheet

Commands

Getting Started

git init

or

@josephg
josephg / 0dedict.py
Last active February 20, 2025 03:12
Apple dictionaries
# Thanks to commenters for providing the base of this much nicer implementation!
# Save and run with $ python 0dedict.py
# You may need to hunt down the dictionary files yourself and change the awful path string below.
# This works for me on MacOS 10.14 Mohave
from struct import unpack
from zlib import decompress
import re
filename = '/System/Library/Assets/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/9f5862030e8f00af171924ebbc23ebfd6e91af78.asset/AssetData/Oxford Dictionary of English.dictionary/Contents/Resources/Body.data'
f = open(filename, 'rb')
@algal
algal / FontUtils.swift
Last active January 12, 2018 18:43
Type-safe font initiazer
//
// MARK: Font utilities
//
enum FontFamily : String {
case HelveticaNeue = "Helvetica Neue"
case MontSerrat = "Montserrat"
}
enum FontWeight {
@stuartjmoore
stuartjmoore / FontMeasure.swift
Created June 21, 2015 21:54
Fix Clipping UITextView
//: Playground - noun: a place where people can play
import XCPlayground
import UIKit
// MARK: - Paragraph Styles
let headlineParagraphStyle = NSMutableParagraphStyle()
headlineParagraphStyle.lineHeightMultiple = 0.8
@Kametrixom
Kametrixom / emoji.swift
Created August 3, 2015 20:46
Gets all Emoji Unicode code points from the latest Unicode source and prints them out (as Emoji). Also: Prints out all country flag emojis from "AA" to "ZZ"
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
func getAllEmojis(completion: String? -> ()) {
let url = NSURL(string: "http://www.unicode.org/Public/UCD/latest/ucd/EmojiSources.txt")!
NSURLSession.sharedSession().dataTaskWithURL(url) { data, response, error in
guard let data = data where error == nil else {
completion(nil)
@paulirish
paulirish / what-forces-layout.md
Last active April 17, 2025 05:10
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ypresto
ypresto / YPLayoutGuideHelper.m
Last active April 20, 2020 15:07
Apply automaticallyAdjustsScrollViewInsets in child view controller like Container View or UIPageViewController
//
// YPLayoutGuideHelper.m
//
// Created by Yuya Tanaka, 2015
//
// This is free and unencumbered software released into the public domain.
// Refer: http://unlicense.org/
//
// automaticallyAdjustsScrollViewInsets doesn't work for child view controllers
// hosted by something like Container View or UIPageViewController.
@n00neimp0rtant
n00neimp0rtant / gist:27829d87118d984232a4
Last active May 24, 2019 15:10
UIVisualEffectView blur radius manipulation (new for iOS 9)
// iOS 9 allows you to animate between visual effects, which gives you the
// ability to manipulate the blur radius. this can be useful for animating
// a backdrop for a custom modal, and with a few tricks, can even be set
// indirectly, allowing you to "scrub" between them back and forth with
// a gesture, just like when you pull down Spotlight.
// these are the two effects you want to transition between
UIVisualEffect *startEffect = nil; // "nil" means no blur/tint/vibrancy (plain, fully-transparent view)
UIVisualEffect *endEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
@jkosoy
jkosoy / CGSize+AspectFunctions.swift
Last active June 3, 2023 18:11
Aspect Fill and Aspect Fit calculations in Swift
// port of http://stackoverflow.com/a/17948778/3071224
import UIKit
import Foundation
extension CGSize {
static func aspectFit(aspectRatio : CGSize, var boundingSize: CGSize) -> CGSize {
let mW = boundingSize.width / aspectRatio.width;
let mH = boundingSize.height / aspectRatio.height;