Skip to content

Instantly share code, notes, and snippets.

@timhettler
timhettler / reveal.js
Created March 12, 2012 16:24
Animating an element from a fixed height to "auto" height using jQuery
var $selector = $('div');
$selector.data('oHeight',$selector.height()).css('height','auto').data('nHeight',$selector.height()).height($selector.data('oHeight')).animate({height: $selector.data('nHeight')},400);
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@timhettler
timhettler / PivtoTable.js
Created October 7, 2020 04:00
Create a look up for a table with key value pairs
function pivotTable(table) {
const map = new Map();
table.forEach(row => { map.set(row.key, row.value); })
return map
}
@timhettler
timhettler / DeployToNetlify.js
Last active October 7, 2020 03:58
Trigger a Netlify Webhook
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Site')
.addItem('Deploy to Netlify', 'callNetlifyToDeploy')
.addToUi()
}
function callNetlifyToDeploy() {
var data = {}
@timhettler
timhettler / ModernReset.css
Created October 18, 2019 14:21
A Modern CSS Reset
/* https://dev.to/hankchizljaw/a-modern-css-reset-6p3 */
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default padding */
@timhettler
timhettler / BaseSvg.js
Last active September 27, 2019 19:54
A component that gives SVGs a consistent API
import React from 'react'
import PropTypes from 'prop-types'
const BaseIcon = ({ viewBox, height, width, type, children, ...rest }) {
// We want the default dimensions to be 100%, which covers most
// use-cases, but only if BOTH the width and height props are not set
const trueWidth = width || height ? width : '100%'
const trueHeight = width || height ? height : '100%'
return (
@timhettler
timhettler / settings.json
Last active June 10, 2019 18:56
Sublime Settings
{
"binary_file_patterns":
[
".DS_Store",
"build/*",
"dist/*",
"node_modules/",
"tmp/",
"*.png", "*.psd", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip", "*.ai",
"*.min.*"
@timhettler
timhettler / flex-grid.scss
Last active January 11, 2018 21:06
A configurable grid system using flexbox
$size--content: 1080px;
$size--column-gutter: 16px;
$size--columns: 8;
@function fluid-width($span) {
@return calc(#{percentage($span/$size--columns)} - #{$size--column-gutter});
}
.container {
margin: 0 $size--column-gutter * 2;
@timhettler
timhettler / .gitignore
Last active December 27, 2015 17:19
My .gitignore file - covers pretty much everything
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@timhettler
timhettler / utils.scss
Created August 22, 2013 15:09
Some useful utility mixins I reach for on many projects. Compass & Bourbon compatible.
//*
// Makes an element appear circular.
@mixin circular() {
border-radius: 50%;
}
//*
// Disables text selection and the on iOS devices that displays information about a link.
@mixin disable-selection() {
@include user-select(none); //disables text selection