Skip to content

Instantly share code, notes, and snippets.

View kristoferjoseph's full-sized avatar
🐈‍⬛

kj kristoferjoseph

🐈‍⬛
View GitHub Profile
@kristoferjoseph
kristoferjoseph / substitute-variable-names
Created December 17, 2013 08:31
vim substitution for CSS variable spec variables
%s/var-\([a-z-]*[__a-z]*[--a-z][^;]\+\)/var(\1)/g
@kristoferjoseph
kristoferjoseph / resin.js
Last active December 27, 2015 12:39
resin: Topcoat preprocessor based on Rework
var rework = require('rework'),
imprt = require('rework-npm'),
vars = require('rework-vars'),
read = require('fs').readFileSync,
css = rework(read('./entry.css', 'utf8'))
.use(imprt())
.use(vars())
.use(rework.extend())
.toString();
@kristoferjoseph
kristoferjoseph / topcoat.json
Last active December 25, 2015 15:38
JSON data for telemetry averages retrieved from db on bench.topcoat.io. You can use this file for local testing.
{ "__v" : 0, "_id" : { "$oid" : "5149a77de3f4091e05000003" }, "commit" : "90dcdc65b15398a3e312caac306b14493837d0c6", "count" : 6, "date" : { "$date" : 1363132800000 }, "device" : "\"catalin_mbp\"", "platform" : "Chrome 25.0.1364 Mac OS X 10.8.2", "result" : { "load_time (ms)" : 348.3333333333333, "dom_content_loaded_time (ms)" : 248.5, "UserAgent ()" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.45 Safari/537.22", "ResourceReceivedData_max (ms)" : 94.82832845056667, "ResourceReceivedData_avg (ms)" : 6.09135877821, "ResourceReceivedData (ms)" : 96.37740071615001, "ResourceReceiveResponse_max (ms)" : 0.005940755208333333, "ResourceReceiveResponse_avg (ms)" : 0.004720052083333333, "ResourceReceiveResponse (ms)" : 0.01888020833333333, "RecalculateStyles_max (ms)" : 85.23063151043333, "RecalculateStyles_avg (ms)" : 36.64253743493333, "RecalculateStyles (ms)" : 219.855224609, "Program_max (ms)" : 25.44982910158333, "Program_avg (ms)" : 0.5138813782576667,
@kristoferjoseph
kristoferjoseph / Gruntfile.js
Created October 7, 2013 16:51
How to add a custom theme to a Topcoat 7.5 build
/*
Copyright 2012 Adobe Systems Inc.;
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@kristoferjoseph
kristoferjoseph / topcoat-button.css
Created August 21, 2013 22:55
Topcoat button skin example
.topcoat-button {
padding: 0 1.25rem;
line-height: 3rem;
border-radius: 6px;
color: #454545;
text-shadow: 0 1px #fff;
background-color: #e5e9e8;
box-shadow: inset 0 1px #fff;
border: 1px solid #a5a8a8;
}
@kristoferjoseph
kristoferjoseph / topcoat-button-base.css
Created August 21, 2013 22:54
Topcoat button base example
.button {
position: relative;
display: inline-block;
vertical-align: top;
box-sizing: border-box;
background-clip: padding-box;
padding: 0;
margin: 0;
font: inherit;
color: inherit;
@kristoferjoseph
kristoferjoseph / viewfactory.js
Created July 31, 2013 17:55
Example View Factory
var viewMappings = {
};
var addMapping = function (type, viewClass) {
viewMappings[type] = viewClass;
};
var create = function (viewModel) {
var ViewClass = viewMappings[viewModel.get("type")];
if (ViewClass) {
@kristoferjoseph
kristoferjoseph / viewfactory.js
Created July 31, 2013 17:55
Example View Factory
var viewMappings = {
};
var addMapping = function (type, viewClass) {
viewMappings[type] = viewClass;
};
var create = function (viewModel) {
var ViewClass = viewMappings[viewModel.get("type")];
if (ViewClass) {
@kristoferjoseph
kristoferjoseph / gridview.js
Created July 31, 2013 12:01
Example of integrating jQuery plugin
var GridView = Backbone.View.extend({
el: "#gridContainer",
$gridEl: undefined,
cartilage: undefined,
initialize: function () {
this.gridUndoHelper = new GridOriginator();
_.bindAll(this, "render");
this.$gridEl = $("<div id='grid'></div>");
@kristoferjoseph
kristoferjoseph / viewmixin.js
Created July 31, 2013 11:40
Reflow Mixin Example
//... Omitted for brevity
var ViewMixin = {
addView: function (itemModel) {
var newView = ViewFactory.create(itemModel);
if (!newView) {
return;
}
var insertPos = Document.getInsertPosition();