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 / dabblet.css
Created April 22, 2012 15:03
Triangular prisms with pseudo-elements and transforms
/**
* Triangular prisms with pseudo-elements and transforms
**/
body {
background: #fff;
}
#origin {
transform-style: preserve-3d;
@jordangray
jordangray / dabblet.css
Created June 19, 2017 16:26
Automasking
/**
* Automasking
*/
.mask-content {
position: relative;
padding: .2em 0;
width: 1.2em;
text-align: center;
}
@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
body {
height: 3000em;
}
.parallax { perspective: 1px; height: 100vh; overflow-x: hidden; overflow-y: auto;}
.parallax__layer { position: absolute; top: 0; right: 0; bottom: 0; left: 0;}
.parallax__layer--base { transform: translateZ(0);}.parallax__layer--back { transform: translateZ(-1px);}
body {
height: 300%;
}
@jordangray
jordangray / jquery.shimFormAction.coffee
Last active February 1, 2017 17:16
A simple shim for the HTML5 formaction attribute.
# Test for formaction attribute support in Modernizer.
Modernizr.addTest 'formaction', 'formaction' of document.createElement('input')
# Shim for formaction attributes on buttons and inputs.
$.fn.shimFormAction = ->
return this if Modernizr.formaction
this.each ->
$(this).find 'input,button'
.filter '[formaction!=""][formaction]'
@jordangray
jordangray / dabblet.css
Last active May 8, 2016 01:04
Shirt pattern
/* Shirt pattern */
/* Colours seen from the top down */
background-image: /* 0 50 100 150 */
linear-gradient(to left, white 10%, transparent 10%), /* white: w w w w */
linear-gradient(to left, steelblue 50%, transparent 50%), /* light blue: llllllllll llllllllll */
linear-gradient(to left, maroon 50%, navy 50%); /* red & blue: rrrrrrrrrrrrrrrrrrrrbbbbbbbbbbbbbbbbbbbb */
background-size: 50px, 100px, 200px;
@jordangray
jordangray / dabblet.css
Created January 22, 2014 00:44
Mock up using custom elements
/* Mock up using custom elements */
body {
margin: 0;
}
cat-timeline,
cat-grid,
cat-gridline,
cat-animations,
@jordangray
jordangray / dabblet.css
Created January 19, 2014 02:20
Testing out a theory
/* Testing out a theory */
/* Grabbed from http://css-tricks.com/myth-busting-css-animations-vs-javascript/?ref=heydesigner */
@keyframes spin {
0% {
color: red;
transform-origin:50% 50% 0;
transform: rotate(0deg) rotateX(0deg) rotateY(0deg);
}
@jordangray
jordangray / dabblet.css
Created January 12, 2014 20:27
UK Transport mockup
/* UK Transport mockup */
/* Basic typography and spacing */
h1 {
font-weight: normal;
font-size: 34px;
}