Skip to content

Instantly share code, notes, and snippets.

View captainill's full-sized avatar

Jonathan Thomas captainill

View GitHub Profile
@alexjlockwood
alexjlockwood / print-unlinked-colors.ts
Created February 3, 2020 21:41
Prints nodes that have fill/stroke colors that aren't linked to a style.
figma.root.children
.flatMap(pageNode => pageNode.findAll(n => true))
.forEach(node => {
if ('fills' in node && 'fillStyleId' in node) {
if (node.fills !== figma.mixed && node.fills.length > 0 && node.fillStyleId !== '') {
print(`${node.name}'s fill color is not linked to a style`);
}
}
if ('strokes' in node && 'strokeStyleId' in node) {
if (node.strokes.length > 0 && node.strokeStyleId !== '') {
@alexjlockwood
alexjlockwood / cleanup-figma-names.ts
Last active November 24, 2021 21:02
Cleans up Figma component and style names
const components = figma.root.children.flatMap(pageNode => {
return pageNode.findAll(node => node.type === 'COMPONENT');
});
const styles = [
...figma.getLocalEffectStyles(),
...figma.getLocalGridStyles(),
...figma.getLocalPaintStyles(),
...figma.getLocalTextStyles(),
];
@zachj0hnston
zachj0hnston / browser.tsx
Created August 15, 2018 21:34
Framer X Browser component
import * as React from "react";
import { Frame, PropertyControls, ControlType } from "framer";
import { FrameProps } from "framer/types/src/render/presentation/Frame";
export class Browser extends React.Component {
static defaultProps = {
@ronalson
ronalson / DS-reading-list.md
Last active September 3, 2020 13:08
Design System / Tokens - Reading List
@davisml
davisml / draftToHTML.js
Last active March 9, 2017 12:47
DraftJS block data to HTML
// AttributedString class from https://github.com/cohitre/attributedString.js
// Modifications made to support html tags & remove span wrapper from unstyled blocks
var AttributedString = (function () {
var aString
, StringRange
, RangesList
, HtmlSerializer
, plainStringSerializer
, _ = {}
, entityMap = {
@fson
fson / rapid-prototyping-with-relay.md
Created October 18, 2015 20:08
Rapid prototyping with Relay (Reactive 2015 lightning talk proposal)

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

Rapid prototyping with Relay

Relay makes data fetching in React apps simpler, by letting you declare the data needs of your components instead of writing complex imperative code. React, Relay, GraphQL and the other complementary tools are changing how apps are built.

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

// built files are found at /public/__build__/*
// how do I get `webpack` to build to `public/__build__/`
// but have the webpack dev server serve `public/index.html`
// and the bundles from `/__build__/`?
//
// I'm using this to run the server
//
// webpack-dev-server --inline --content-base public/
//
// and this is my config:
var STATE = {
books: new Backbone.Collection([], {
model: Models.BOOK_MODEL
}),
users: new Backbone.Collection([], {
model: Models.USER_MODEL
}),
categories: new Backbone.Collection([], {
model: Models.CATEGORY_MODEL
})
@gaearon
gaearon / createAsyncPage.jsx
Last active April 25, 2023 09:06
Webpack's async code splitting with React Router
'use strict';
var React = require('react');
function createAsyncHandler(getHandlerAsync, displayName) {
var Handler = null;
return React.createClass({
displayName: displayName,