Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / gist:4030944
Last active September 12, 2020 12:44
Convert an image sequence to a 1080p video
brew install ffmpeg
ffmpeg -start_number 079 -y -r 30 -i "DSC_0%03d.JPG" -vf scale=1920:-1,crop=1920:1080 -vcodec libx264 -b:v 10000k -r 30 outputhd.m4v
# Optional bits
# -start_number: the first number in the sequence (default: 0)
# -y: overwrite output files without asking
# -r: input framerate (i.e. photos per second. The second -r is the output framerate)
# -i: input files. %03d = 3 digits (so this example would use DSC_0079.JPG - DSC_0999.JPG)
# Picked 10000k for the bitrate based on https://support.google.com/youtube/answer/1722171?hl=en
@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>

SMACSS + Sass + BEM

SMACSS

Scalable and
Modular
Architecture for
C
S
S

@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 November 25, 2013 05:01
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$unquoted-string: unquote("foo")
$quoted-string: quote(foo)
body
background: $unquoted-string == $quoted-string
<div class="gallery">
<div class="gallery__item">
<div class="photo"></div>
</div>
<div class="gallery__item">
<div class="video"></div>
</div>
<div class="gallery__item">
<div class="audio"></div>
</div>
@bensmithett
bensmithett / gist:7110383
Last active December 26, 2015 06:49
Custom styles for nested modules
<div class="parent">
<div class="parent__children">
<div class="child"></div>
<div class="child--modified"></div>
</div>
</div>
@bensmithett
bensmithett / SassMeister-input.sass
Created October 16, 2013 04:57
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.7)
// ----
$ie7: false
$resp: true
body
// Output MQs