Skip to content

Instantly share code, notes, and snippets.

 writing apps i want to use

Junda samwize

 writing apps i want to use
View GitHub Profile
View FetchAndDecode.swift
// A URLSession extension that fetches data from a URL and decodes to some Decodable type.
// Usage: let user = try await URLSession.shared.decode(UserData.self, from: someURL)
// Note: this requires Swift 5.5.
extension URLSession {
func decode<T: Decodable>(
_ type: T.Type = T.self,
from url: URL,
keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = .useDefaultKeys,
dataDecodingStrategy: JSONDecoder.DataDecodingStrategy = .deferredToData,
dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .deferredToDate
samwize / Device.h
Created October 21, 2012 06:26
Convenient class to handle the new iPhone 5 taller screen
View Device.h
#import <Foundation/Foundation.h>
@interface Device : NSObject
/** Returns true if it is a iPhone/iPod with 4 inch tall screen */
artero / launch_sublime_from_terminal.markdown
Last active April 27, 2023 15:46 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal
View launch_sublime_from_terminal.markdown

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\

You can find more (official) details about subl here: