Skip to content

Instantly share code, notes, and snippets.

@JAStanton
JAStanton / A) CSS Animation Imports
Last active August 29, 2015 14:13
CSS Animation Imports
CSS animations (and the GPU) are really good at animating position, rotation, or
scale, this combined with beautiful bezier curve transitions and if you're
creative you can come up with some pretty amazing animations. However if you've
ever worked on any large or more complex web animations, especially if you're
porting them over from after effects you're bond to run into some limit of the
web and pretty quickly and have to resort to expensive hacks.
The main walls I ran into with CSS can be solved by this; If CSS has the ability
to compose animations into a hierarchy of groups. After effects calls these
compositions. (http://helpx.adobe.com/after-effects/using/composition-
@JAStanton
JAStanton / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@JAStanton
JAStanton / gist:ddf0bef0f32ea4813fb4
Created June 4, 2014 18:04
Extending primitives
extension Double {
var km: Double { return self * 1_000.0 }
var m: Double { return self }
var cm: Double { return self / 100.0 }
var mm: Double { return self / 1_000.0 }
var ft: Double { return self / 3.28084 }
}
let oneInch = 25.4.mm
println("One inch is \(oneInch) meters")
// prints "One inch is 0.0254 meters"
@JAStanton
JAStanton / gist:c720f18c6d8b2b83e3d3
Last active August 29, 2015 14:02
Swift Closures
// old fashion way to pass a sorting function
func backwards(s1: String, s2: String) -> Bool {
return s1 > s2
}
var reversed = sort(names, backwards)
// with closures, the {} denotes a function, everythig before 'in' keyword is function definition
reversed = sort(names, { (s1: String, s2: String) -> Bool in
return s1 > s2
})
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" type="text/css" href="../sub-element/sub-element.html">
<link rel="import" type="text/css" href="../my-super/my-super.html">
<polymer-element name="my-app" extends="my-super">
<template>root <content></content><shadow></shadow></template>
<script type="text/javascript">
Polymer('my-app', {
ready: function() {
this.subElement = new SubElement();
@JAStanton
JAStanton / console log trick
Created April 12, 2013 21:30
fun console log tricks
console.log("%c ", 'background: url("http://placekitten.com/200/200"); padding: 5000px')
url_domain (data) ->
a = document.createElement 'a'
a.href = data
a.hostname
@JAStanton
JAStanton / Google IO 2013 Binary Easter Egg
Last active December 14, 2015 14:59
goto https://developers.google.com/events/io/ and use these codes to get into secret easter egg locations of Google IO.
space: 00101010
pong: 10000001
simone: 11010011
eightbit: 01010011
song: 11011011
synth: 10001000
ascii: 01111111
bowling: 01110101
rocket: 01000101
burger: 00111001
_ _
.-""-. ( )-"```"-( ) .-""-.
/ O O \ / \ / O O \
|O .-. \ / 0 _ 0 \ / .-. O|
\ ( ) '. _| (_) | .' ( ) /
'.`-' '-./ | |`\.-' '-'.'
\ | \ \ / / | /
\ \ '. '._.' .' / /
\ '. `'-----'` .' /
\ .' '-._ .-'\ '. /
@JAStanton
JAStanton / dabblet.css
Created August 2, 2012 16:10
Reaction:
body{
font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif;
}
#wrapper{
background: url("http://m-local.wavii.com:3000/assets/mobile/page_background@2x.jpg");
height: 100%;
width: 320px;
padding: 20px;
}