Skip to content

Instantly share code, notes, and snippets.

View LunaticMuch's full-sized avatar
💢
I am distilling the world into a model

Stefano LunaticMuch

💢
I am distilling the world into a model
View GitHub Profile
@kharrison
kharrison / URLSession+Extension.swift
Created January 3, 2021 16:46
Using Result with URLsession
public enum NetworkingError: Error {
case unknown
case unexpectedStatus(HTTPURLResponse)
}
extension URLSession {
func load(_ url: URL,
completionHandler: @escaping (Result<Data, Error>) -> Void)
-> URLSessionDataTask {
let task = dataTask(with: url) { data, response, error in
@designatednerd
designatednerd / AsyncToSync.swift
Created October 15, 2019 23:05
Playground showing how to take an async API and make it synchronous
import UIKit
struct AsyncAPI {
enum AsyncAPIError: Error, LocalizedError {
case callDidNotCompleteSynchronously
case noErrorAndNoData
var errorDescription: String? {
switch self {
// Authoer: The SwiftUI Lab
// Full article: https://swiftui-lab.com/scrollview-pull-to-refresh/
import SwiftUI
struct RefreshableScrollView<Content: View>: View {
@State private var previousScrollOffset: CGFloat = 0
@State private var scrollOffset: CGFloat = 0
@State private var frozen: Bool = false
@State private var rotation: Angle = .degrees(0)
@smola
smola / jira_adjust_time_tracking.py
Created May 24, 2016 15:07
jira_adjust_time_tracking.py
#!/usr/bin/env python
# coding: utf-8
"""
Adjusts the time tracking for issues in a given JIRA project.
Requires 'jira' library:
$ pip install jira
JIRA credentials need to be stored in a file '.jira_auth.json'.
Its contents should be:
@aws-scripting-guy
aws-scripting-guy / vs_code_behind_proxy
Created March 7, 2016 13:35
Visual Studio Code - working with git behind proxy
git config --global http.proxy http://myproxyserver:8080