Skip to content

Instantly share code, notes, and snippets.

View jakubknejzlik's full-sized avatar

Jakub Knejzlík jakubknejzlik

View GitHub Profile
@shaps80
shaps80 / cURL+Request.swift
Last active December 23, 2023 17:43
Generates a cURL command representation of a URLRequest in Swift.
import Foundation
extension URLRequest {
/**
Returns a cURL command representation of this URL request.
*/
public var curlString: String {
guard let url = url else { return "" }
var baseCommand = #"curl "\#(url.absoluteString)""#
@mkj-is
mkj-is / Nibable.swift
Last active October 13, 2020 10:20
Simple Nibable protocol for simple initialization of views from nib
//
// Nibable.swift
//
// Created by Matěj Kašpar Jirásek on 12/08/16.
// Copyright © 2016 Matěj Kašpar Jirásek. All rights reserved.
//
import UIKit
protocol Nibable {
@nbasham
nbasham / UIColor.swift
Last active December 18, 2023 21:04
Swift 4: Convert CSS color names and RGB hex values to UIColor. UIColor from hex 3, 4, 6, and 8 characters in length with or without # prefix. UIColor to hex. UIColor extension that creates immutable UIColor instances from hexadecimal and CSS color name strings (e.g. ff0, #f00, ff0000, ff0000ff, Pink, aZure, CLEAR, nil). Conversely, you can obta…
//
// UIColor.swift
// previously Color+HexAndCSSColorNames.swift
//
// Created by Norman Basham on 12/8/15.
// Copyright ©2018 Black Labs. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights