Skip to content

Instantly share code, notes, and snippets.

<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 / 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
})
@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 / 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 / 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-
➜ browser.html-master python --version
Python 2.7.6
➜ browser.html-master npm install
npm WARN package.json browser.html@0.0.2 scripts['server'] should probably be scripts['start'].
node-uuid@1.4.3 node_modules/node-uuid
requirejs@2.1.16 node_modules/requirejs
immutable@3.6.2 node_modules/immutable
// (This is psuedo code)
class fooAction extends store {
addFoo(foo, bar, baz) {
return new Promise(function(reject, resolve) {
ajax(function(response, error) {
if (error) {
// I want to pass two arguments here but it will noly pass the first one.
reject({foo, error});
} else {
import React from 'react/addons';
import { Input } from 'react-bootstrap';
class StateProxy {
constructor(rootComponent, pathPrefix) {
this._rootComponent = rootComponent;
this._pathPrefix = pathPrefix;
}
get(path) {
return _.get(this._rootComponent.state, this._pathPrefix.concat(path));
Last login: Fri Sep 18 15:22:13 on console
/Users/jas/AwesomeProject/node_modules/react-native/packager/launchPackager.command ; exit;
➜ ~ /Users/jas/AwesomeProject/node_modules/react-native/packager/launchPackager.command ; exit;
@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;
}