Skip to content

Instantly share code, notes, and snippets.

@bensmithett
bensmithett / subset.sh
Created July 16, 2021 23:27
Convert & subset a TTF font to WOFF2 with glyphhanger
glyphhanger --subset=*.ttf --formats=woff2 --LATIN
@bensmithett
bensmithett / examples.txt
Created July 9, 2018 01:22
Learning awk
$ awk '/Jade/ && !/English/' ./students.csv
5553,Jade,Mathematics,100,,,
$ awk '/Jade/' ./students.csv
5553,Jade,English,73,,,
5553,Jade,Mathematics,100,,,
$ awk '/Jade/ {print "****"}' ./students.csv
****
@bensmithett
bensmithett / button.js
Last active March 28, 2016 23:30
React for templates
// Low level component
// I can see the HTML, classnames, etc that make it up
// You need to at this point
import React from 'react'
import classnames from 'classnames'
const Button = ({children, type, disabled}) => {
const classes = classnames('button', {
'-primary': type === 'primary',
@bensmithett
bensmithett / SassMeister-input.sass
Created July 13, 2015 06:29
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.my-module
color: red
&.-bar
color: blue

The app's library of UI components.

Designer owns this! Everything here is rendered in a living style guide. CSS for each component will probably live alongside here when we inevitably go down that road...

components/
  __tests__/
  button.js
  form.js
@bensmithett
bensmithett / notes.md
Created February 11, 2015 22:41
@orodio's melbjs flux talk

Make server calls from action creator, but don't dispatch an action. When the promise resolves, call another function that actually dispatches an action.

dispy is cool, abstracts a bit of boilerplate

  • Store.subscribe/unsubscribe
  • Stores register individual callbacks for each action rather than a big switch.
  • Simple mixin to get initial state & update it with one function (in controller view) mixins: [subscribe(state, store)]

orodio/melbjs-feb-2015

@bensmithett
bensmithett / SassMeister-input-HTML.html
Last active August 29, 2015 14:11
Generated by SassMeister.com.
<div class="grid">
<div class="grid__col"><div class="content">foo</div></div>
<div class="grid__col"><div class="content">foo</div></div>
<div class="grid__col"><div class="content">foo</div></div>
</div>
<div class="grid -gutters">
<div class="grid__col"><div class="content">foo</div></div>
<div class="grid__col"><div class="content">foo</div></div>
<div class="grid__col"><div class="content">foo</div></div>
@bensmithett
bensmithett / SassMeister-input.sass
Created December 11, 2014 03:12
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.foo
color: red
@media screen and (min-width: 1024px)
color: blue
@bensmithett
bensmithett / AppComponent.cjsx
Last active April 20, 2020 06:59
The world's tiniest guide to getting started with React, JSX, CoffeeScript & Webpack
React = require("react")
VideoPlayerComponent = require("components/VideoPlayerComponent")
AppComponent = React.createClass
# Need to add this manually if you want it to show up in React Chrome Dev Tools
# See https://github.com/jsdf/coffee-react-transform/issues/16
displayName: "AppComponent"
render: ->
<div>
@bensmithett
bensmithett / SassMeister-input-HTML.html
Created August 24, 2014 01:22
Generated by SassMeister.com.
<a am-Button am-type="downcase">Foo!</a>