Skip to content

Instantly share code, notes, and snippets.

Glen Maddern geelen

Block or report user

Report or block geelen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View button.js
import React, { PropTypes } from 'react'
import styled, { css } from 'styled-components'
const commonClasses = 'link dib f5 fw6 tracked tc br2 ttu ba pointer'
const sizes = ['large', 'small', 'extra-large']
const types = ['success', 'warning', 'danger', 'primary', 'default']
const sizedBtnClasses = {
'large': 'h3 pa3',
View debug.jsx
import React from 'react'
import styled from 'styled-components'
const Pre = styled.pre`
background-color: papayawhip;
color: palevioletred;
padding: .5rem;
font-family: monospace;
`
View perf.js
function makeRandomColor() {
return '#' + Math.random().toString(16).substr(-6)
}
let tag = document.createElement('style')
tag.type = 'text/css'
tag.appendChild(document.createTextNode(''));
(document.head || document.getElementsByTagName('head')[0]).appendChild(tag)
let styleSheet = [...document.styleSheets].filter(x => x.ownerNode === tag)[0]
View 1_locals.css
/* equivalent to postcss-local-scope. INPUT: */
.outer {
color: papayawhip;
box-shadow: 0 0 10px;
}
/* OUTPUT: */
@export .outer ".outer-abcs12r3adudas";
View 1_Readme.md

Global traits, local components

The idea is to combine the best bit of global styling (reuse, small payload) and local styling (total isolation, first-class React syntax)

This is combined with the concept of traits: you can think of them as permitted property/value pairs. Instead of every component being able to have every CSS property available to it, you can reduce your permitted set to X font families, Y font-size + line-height pairs, Z foreground/background colour pairs, W padding amounts. This is based off my work using amcss on real projects — traits were the single key feature that kept me using AM.

The one-sentence explanation: A site defines a set of permitted visual features, all components are simply a combination of those features

Definitions

@geelen
geelen / notes.md
Last active Aug 29, 2015
Alternate approaches to nextTick
View notes.md

setTimeout & nextTick were in source-definition order. No matter how many promises I added, they always got executed first. handy!

All of them fire immediately after the animation frame has fired:

@geelen
geelen / notes.md
Created Jan 27, 2015
WebkitForWayland notes on Tegra Nouveau drivers
View notes.md

After the previous attempt and raising an issue, I am trying to install again with a fresh rootfs as described here

First attempt failed with missing dependencies, so I reran a command from last time:

sudo apt-get install build-essential autoconf automake autopoint libtool intltool bison flex libgnutls28-dev libxml2-dev libsqlite3-dev

Stuck on installing Weston — it's missing a dependency on libinput which I can't find in the repo and the build instructions for Weston reference as needing to be built from source. Seems like this should be part of the dependency tree for Webkit, then?

@geelen
geelen / gulpfile.js
Last active Oct 11, 2017 — forked from superhighfives/gulpfile.js
Harp with BrowserSync! Woo!
View gulpfile.js
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var harp = require('harp');
/**
* Serve the Harp Site from the src directory
*/
gulp.task('serve', function () {
harp.server(__dirname + '/src', {
@geelen
geelen / gist:2e314d9c547b752603fd
Last active Aug 29, 2015
Web Component design thoughts
View gist:2e314d9c547b752603fd

Web Component design thoughts

It feels like I'm facing the same thing the same problems writing the API of these components. In particular:

  • A component might have several distinct modes. As in, an <x-gif speed="1.0"> has a very different playback mode from <x-gif bpm="120">, so you shouldn't be allowed to have both speed and bpm. But it doesn't seem right to break them into separate components, so either one takes precedence or having both present causes an explosion.
  • A component might require more than one attribute to be valid. As in, <x-beat midi channel="0" note="65">. Until you have both the channel and note you can't make connection to the midi signal. But if you're driving the component with a framework like angular, it will first render incompletely (as <x-beat midi channel="{{ channel }}" note="{{ note }}">), then after a $digest will insert the right values. So a component may need to permit being in an invalid state temporarily, then when all attributes are set go and get
View designer.html
<link rel="import" href="https://raw.githubusercontent.com/geelen/x-gif/gh-pages/dist/x-gif.html">
You can’t perform that action at this time.