Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
@duhaime
duhaime / gh-pages-deploy.md
Created June 18, 2018 22:51 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@duhaime
duhaime / index.html
Last active April 5, 2018 19:18 — forked from wboykinm/index.html
Map with Georectified Video Asset
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Mapbox GL JS Examples</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.2.0/mapbox-gl.js'></script>
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
@duhaime
duhaime / index.html
Created March 27, 2018 15:09 — forked from veltman/index.html
Gradual pixelation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<canvas width="960" height="500"></canvas>
<script>
var canvas = document.querySelector("canvas"),
@duhaime
duhaime / README.md
Created March 27, 2018 15:08 — forked from veltman/README.md
Duotoning

Using SVG filters to apply a duotone effect.

@duhaime
duhaime / .block
Created March 27, 2018 15:03 — forked from summer4096/.block
Mapbox GL 3d data demo
license: MIT
@duhaime
duhaime / .block
Created March 27, 2018 15:00 — forked from rveciana/.block
Path in a map, animated with scroll
scrolling: yes
@duhaime
duhaime / README.md
Created January 1, 2018 15:46 — forked from newby-jay/LICENSE
Vector field flow visualization
@duhaime
duhaime / index.html
Created January 1, 2018 15:45 — forked from syntagmatic/index.html
Canvas Random Motion
<canvas id="canvas"></canvas>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var num = 20000;
var canvas = document.getElementById("canvas");
var width = canvas.width = 960;
var height = canvas.height = 500;
var ctx = canvas.getContext("2d");
@duhaime
duhaime / what-forces-layout.md
Created December 10, 2017 03:18 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@duhaime
duhaime / web-servers.md
Created November 25, 2017 15:32 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000