Skip to content

Instantly share code, notes, and snippets.

View adamcbrewer's full-sized avatar

Adam Brewer adamcbrewer

View GitHub Profile
@stugoo
stugoo / Gruntfile.js
Created April 1, 2014 13:23
Grunt, scss and hbs for turning svgs into icons and pngs,
// requires
/*
* https://github.com/filamentgroup/grunticon
* https://www.npmjs.org/package/grunt-text-replace
*/
'use strict';
module.exports = function (grunt) {
@lukes
lukes / rant.js
Created December 18, 2014 21:38
<rant> to actual rant
// <rant> to actual rant
// (requires modern browsers)
var rants = document.getElementsByTagName('rant');
for (i=0;i<rants.length;i++) {
var rant = new SpeechSynthesisUtterance(rants[i].innerHTML);
window.speechSynthesis.speak(rant);
}
@stephensauceda
stephensauceda / gulpfile.babel.js
Created June 11, 2015 23:45
ES6 Gulpfile Example
/*
* Steps
* 1. Rename your gulpfile.js to gulpfile.babel.js
* 2. Add babel to your package.json (npm install -D babel)
* 3. Start writing ES6 in your gulpfile!
*/
import gulp from 'gulp'; // ES6 imports!
import sass from 'gulp-sass';
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@pizzarob
pizzarob / 01_DropZone.jsx
Last active November 14, 2017 08:28
HTML5 Drag and Drop File Upload React Component
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
const ANIMATION_DURATION = 1000;
class BatchDropZone extends React.Component {
static propTypes = {