Skip to content

Instantly share code, notes, and snippets.

@kellysutton
kellysutton / graphql-example.txt
Last active January 2, 2017 20:52 — forked from anonymous/graphql-example.txt
Do we need GraphQL?
POST /graphql
Content-Type: application/graphql
{
post(id: 1) {
id
title
comments {
id
body
}
@kellysutton
kellysutton / Gemfile
Last active October 31, 2016 04:35
strict-templates-examples
gem 'strict_templates'
@kellysutton
kellysutton / application.js
Last active September 10, 2016 20:00
Real-time Recipe for Rails and Ember using Pusher
// app/routes/application.js
import Ember from 'ember';
export default Ember.Route.extend({
currentUser: Ember.inject.service(),
pusher: Ember.inject.service(),
activate() {
this._listenToPusherEvents();
},
@kellysutton
kellysutton / generative-utility-colors.sass
Last active July 27, 2016 18:05
Generating Color Utility Classes in SASS
$color-list {
red #f00,
green #0f0,
blue #00f
}
@each $value in $color-list {
.#{nth($value, 1)} {
color: nth($value, 2);
}
<img srcset="https://assets.imgix.net/flower.jpg?w=50 50w,
https://assets.imgix.net/flower.jpg?w=100 100w,
https://assets.imgix.net/flower.jpg?w=150 150w,
...
https://assets.imgix.net/flower.jpg?w=5200 5200w,
https://assets.imgix.net/flower.jpg?w=5260 5260w"
src="https://assets.imgix.net/flower.jpg?w=540"
alt="A white flower"
/>
@kellysutton
kellysutton / img.html
Created April 20, 2016 05:35
srcset insanity
<img srcset="https://assets.imgix.net/flower.jpg?w=50 50w,
https://assets.imgix.net/flower.jpg?w=100 100w,
https://assets.imgix.net/flower.jpg?w=150 150w,
https://assets.imgix.net/flower.jpg?w=200 200w,
https://assets.imgix.net/flower.jpg?w=250 250w,
https://assets.imgix.net/flower.jpg?w=300 300w,
https://assets.imgix.net/flower.jpg?w=350 350w,
https://assets.imgix.net/flower.jpg?w=400 400w,
https://assets.imgix.net/flower.jpg?w=450 450w,
https://assets.imgix.net/flower.jpg?w=500 500w,
@kellysutton
kellysutton / srcset.html
Created August 5, 2015 02:44
srcset examples
<img
srcset="asset.png,
asset-2x.png 2x,
asset-3x.png 3x"
src="asset.png"
/>
requirejs.config({
paths: {
ramda: 'https://cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min'
}
});
require(['ramda'], function (_) {
const trace = _.curry(function(tag, x) {
console.log(tag, x);
return x;
@kellysutton
kellysutton / cleanup.js
Last active August 29, 2015 14:25
cleanup.js
import Ember from 'ember';
const { computed, on } = Ember;
// Our Higher Order Function, as before
let has = field => computed.notEmpty(field);
// The Component UI fields as before.
const UI_FIELDS = ['userName', 'password'];
@kellysutton
kellysutton / clean-template.hbs
Last active August 29, 2015 14:15
Reducing “action cruft” in your Ember templates
{{post-detail post=post}}