Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jordangray's full-sized avatar
💭
I may be slow to respond.

Jordan Gray jordangray

💭
I may be slow to respond.
View GitHub Profile
@jordangray
jordangray / colorFromHexString.swift
Last active May 23, 2017 01:36 — forked from shadcn/gist:de147c42d7b3063ef7bc
Convert a string representing a CSS hex colour to a UIColor in Swift.
/// Get the UIColor corresponding to a CSS hex color code (RGB[A] or RRGGBB[AA])
///
/// - Parameter hex: A hexadecimal representation of the colou
/// - Returns: The UIColor represented by the hexidecimal color code, or UIColor.clear if parsing failed
func colorFromHexString (hex:String) -> UIColor {
// Remove padding, leading hash symbol etc.
let hex = hex.trimmingCharacters(in: NSCharacterSet.alphanumerics.inverted)
// Get numeric representation
@jordangray
jordangray / dabblet.css
Created February 8, 2012 22:05 — forked from LeaVerou/dabblet.css
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);