Skip to content

Instantly share code, notes, and snippets.

View xr1337's full-sized avatar

Sufiyan Yasa xr1337

View GitHub Profile
@xr1337
xr1337 / main.go
Created August 10, 2020 01:58
medical_records
package main
import (
"encoding/json"
"fmt"
"net/http"
"sort"
"time"
)
@xr1337
xr1337 / question.swift
Created August 10, 2020 01:59
unique substrings
import Cocoa
func fewestCoins(coins: String) -> Int {
let coinsArray = Array(coins)
let checkSet :Set = Set(coinsArray)
let countedSet :NSCountedSet = NSCountedSet()
// validation when the lenght of the string == amount uniq characters
if(checkSet.count == coins.count || checkSet.count == 0) {
return coins.count
@xr1337
xr1337 / Example script to open all logs
Last active May 24, 2021 08:02
A script to stream all the logs that simulator is currently booted
#/bin/bash
A=`xcrun simctl list | grep Booted | perl -ne 'print "$1\n" if / \(([0-9A-Z\-]+)\) /' | sort | uniq `
for UUID in $A
do
xcrun simctl spawn $UUID log stream --level debug\
--timeout 1h\
--style compact \
--predicate 'subsystem == "my.domain.name"' &
done
@xr1337
xr1337 / DecodableResult.swift
Last active December 9, 2022 23:05
A json wrapper that holds the decode status of json objects. Generally used to decode JSON container items that may fail such as JSON Arrays.
/// This is wrapper that holds the decode status of json objects
/// It is useful for JSON arrays where if one child JSON node fails to decode, the whole array is not nil
/// Example use: try JSONDecoder().decode([DecodableResult<MyProduct>]).compactMap { try? $0.result.get() }
struct DecodableResult<T: Decodable>: Decodable {
let result: Result<T, Error>
init(from decoder: Decoder) throws {
result = Result(catching: { try T(from: decoder) })
}
}

Best in Class iOS Apps

What things can I quantify that help make an app great?

A summary of: A Best in Class iOS App

The five sections this document covers are:

  1. Accessibility: Designing for everyone is the right thing to do, and the best apps do it and they do it exceptionally well.
  2. Platform Technology: Apple loves it when apps utilize their new APIs to great effect, you should too. It’s not about shoehorning features, it’s about looking at your product and seeing how to utilize iOS around it.