Skip to content

Instantly share code, notes, and snippets.

View didoo's full-sized avatar

Cristiano Rastelli didoo

View GitHub Profile
@arlodesign
arlodesign / README.md
Last active December 12, 2016 21:46
Compare CSS
  1. Download this gist into a csscompare folder

  2. npm install

  3. Create before and after folders. Your folder should now look like this:

     - /csscompare
     |- /after
     |- /before
     |- /npm_modules
     |- index.js
    

|- package.json

@piotrfonte
piotrfonte / lines.js
Created September 18, 2017 11:30
Fluid-type typography and spacing (border, margin, padding) for `styled-components`.
export const lines = {
h: '1.8em',
l: '1.6em',
m: '1.4em',
s: '1.2em',
x: '1',
n: '0',
}
export const _line = lines;
@oliverturner
oliverturner / extensions.txt
Created June 9, 2018 18:20
VSCode extensions for general web dev
Orta.vscode-jest
Shan.code-settings-sync
christian-kohler.npm-intellisense
christian-kohler.path-intellisense
codezombiech.gitignore
dbaeumer.vscode-eslint
esbenp.prettier-vscode
jasonlhy.vscode-browser-sync
jpoissonnier.vscode-styled-components
kumar-harsh.graphql-for-vscode
@davo
davo / Grid.tsx
Last active September 15, 2018 16:28
CSS Grid for Framer X
import * as React from 'react'
const container: React.CSSProperties = {
width: '100%',
height: '100%',
display: 'grid',
gridTemplateColumns: '10rem 10rem 10rem 10rem'
}
const item: React.CSSProperties = {
@aalokt89
aalokt89 / LayerComponent.tsx
Created August 26, 2018 18:36
Framer X Data and props Animation
import * as React from "react";
import {
Frame,
Data,
Animatable,
animate,
PropertyControls,
ControlType
} from "framer";
@romannurik
romannurik / tab-widget.tsx
Created August 23, 2018 15:51
A proof-of-concept Tab widget for Framer X
import { ControlType, PropertyControls } from "framer";
import * as React from "react";
interface TabWidgetProps {
selectedTab: number;
accentColor: string;
}
@threepointone
threepointone / infinite.js
Created December 20, 2016 08:44
infinite scrolling pattern with react fiber (featuring intersection observers)
// inifinite scrolling of content without extra wrappers
const { render, findDOMNode } = ReactDOMFiber
class App extends React.Component {
render() {
// wrap the root element with an Intersection Observer, exposing .observe for children
return <Intersection>
<div style={{ height: 200, overflow: 'auto' }}>
<Page offset={0} count={10} />
</div>
@paulsturgess
paulsturgess / Todo.test.js
Last active October 8, 2018 11:22
Testing a stateless component
import React from 'react';
import TestUtils from 'react/lib/ReactTestUtils';
import Todo from './Todo';
describe('Todo', () => {
let instance, li;
let Wrapper = React.createClass({
render: function() {
return this.props.children;
}
static propertyControls: PropertyControls = {
text: { type: ControlType.String, title: 'Text' },
fontSize: {
type: ControlType.FusedNumber,
toggleKey: 'fontPerBP',
toggleTitles: ['Font', 'Font per BP'],
valueKeys: ['font1', 'font2', 'font3', 'font4'],
valueLabels: theme.breakpoints.map(s => s.replace('px', '')),
min: 0,
title: 'Font Size',
@scmx
scmx / react-proptype-warnings-as-errors-with-sinon.markdown
Last active March 1, 2019 08:42
Make React PropType warnings throw errors with mocha.js, enzyme.js and sinon.js

Make React PropType warnings throw errors with enzyme.js + sinon.js + mocha.js

A simple stateless functional component that we want to test that it renders without propType warnings.

import React, { PropTypes } from 'react'

let VersionListItem = function ({ active, version }) {
  return (