Skip to content

Instantly share code, notes, and snippets.

@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)""#
@peterprokop
peterprokop / URLRequest.swift
Last active August 29, 2022 15:40
Print NSURLRequest in cURL format (Swift 3)
//
// URLRequest.swift
//
// Created by Peter Prokop on 17/08/2017.
import Foundation
public extension URLRequest {
/// Returns a cURL command for a request
@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
<!DOCTYPE html>
<html>
<head><title>content list</title>
<link href='http://fonts.googleapis.com/css?family=Julius Sans One:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Special Elite|Satisfy' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Economica:400,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="file.css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Metal Mania:400,300' rel='stylesheet' type='text/css'>
<style>
a:link { font-family: 'Economica' ,sans-serif;