Skip to content

Instantly share code, notes, and snippets.

/* ----------------------------------------------------------------------------------------------------
Super Form Reset
A couple of things to watch out for:
- IE8: If a text input doesn't have padding on all sides or none the text won't be centered.
- The default border sizes on text inputs in all UAs seem to be slightly different. You're better off using custom borders.
- You NEED to set the font-size and family on all form elements
- Search inputs need to have their appearance reset and the box-sizing set to content-box to match other UAs
@anthonyshort
anthonyshort / _media-queries.scss
Created March 13, 2012 10:37
Media Queries in Sass
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
{
"feature1": ["foo2@foo.com"]
}
@anthonyshort
anthonyshort / 1.Principles.md
Last active February 22, 2023 06:45
Functional API for Deku
  • Prefer composition over mixins
  • Prefer immutablity
  • Avoid using events as they create side-effects
  • Lifecycle methods should always be a single function. e.g. button.beforeMount(cxt)
  • Declarative API with everything declared the same way in the same place
  • Avoid the need for deku-specific plugins, it should make composition easy
  • Avoid magic and complex APIs. Functions should just be functions with no side-effects.
@anthonyshort
anthonyshort / people.json
Created February 17, 2022 22:20
People List
[
{
"id": "38016cdf-03fe-4a3b-a9df-8411bf43876c",
"firstName": "Orren",
"lastName": "Priest",
"email": "opriest0@aboutads.info",
"photo": "https://robohash.org/repudiandaeaeligendi.png?size=50x50&set=set1",
"department": "Support"
},
{
@anthonyshort
anthonyshort / machine.js
Last active September 25, 2020 22:16
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
#form-search input
{
-webkit-appearance:none;
border:1px solid #cfcfcf;
border-right:0;
height:23px;
width:200px;
font:inherit;
float:left;
padding:0 3px;
@anthonyshort
anthonyshort / Component.tsx
Last active February 16, 2019 16:04
React hooks + Apollo client
import useQuery from './useQuery'
import gql from 'graphql-tag'
type Props = {
projectId: string
}
export default function Project(props: Props) {
const { data, loading } = useQuery({
query: gql`
@anthonyshort
anthonyshort / gist:1178298
Created August 29, 2011 12:31
Prefixing with Sass
@mixin border-radius($radius, $prefixes: -moz -webkit -o) {
@each $prefix in $prefixes {
#{$prefix}-border-radius:$radius;
}
border-radius:$radius;
}
#id {
@include border-radius(5px, -moz -webkit);
/**
* Stream of dots from the integrations browser
*/
var dots = new IntegrationStream({
el: document.querySelector('.js-integration-stream')
});
/**
* Create a stream
*