Skip to content

Instantly share code, notes, and snippets.

@tildebyte
tildebyte / CSS3_`length`_property_units.md
Last active January 31, 2017 14:44
There are quite a few properties in CSS that take a length as a value. What are all the accepted "length" properties in CSS? There are quite a few.

Captured from https://css-tricks.com/the-lengths-of-css

There are quite a few properties in CSS that take a length as a value. The box model properties are the obvious ones: width, height, margin, padding, border. But plenty of others as well: the offset and sizing of a box-shadow or the size and spacing of fonts. What are all the accepted "length" properties in CSS? There are quite a few.

The Absolute Lengths

px

.wrap {
@tildebyte
tildebyte / Less-Angry_Rainbow_hex.js
Created December 27, 2016 19:53
Less angry rainbow palette, hex strings as a list (Python or JS). From https://mycarta.wordpress.com/2012/05/29/the-rainbow-is-dead-long-live-the-rainbow-series-outline via Mike Bostock.
PALETTE = ['#6D3FA9', '#6E3FAA', '#6F3FAA', '#703FAA', '#703FAB', '#713FAB', '#723FAB', '#733FAC', '#743FAC', '#753FAC', '#753FAC', '#763FAD', '#773FAD', '#783FAD', '#793EAD', '#7A3EAE', '#7A3EAE', '#7B3EAE', '#7C3EAE', '#7D3EAF', '#7E3EAF', '#7F3EAF', '#803EAF', '#803EAF', '#813EB0', '#823EB0', '#833EB0', '#843EB0', '#853EB0', '#863EB0', '#863DB1', '#873DB1', '#883DB1', '#893DB1', '#8A3DB1', '#8B3DB1', '#8C3DB1', '#8D3DB2', '#8D3DB2', '#8E3DB2', '#8F3DB2', '#903DB2', '#913DB2', '#923DB2', '#933DB2', '#933DB2', '#943DB2', '#953DB2', '#963DB2', '#973DB2', '#983CB3', '#993CB3', '#9A3CB3', '#9B3CB3', '#9B3CB3', '#9C3CB3', '#9D3CB3', '#9E3CB3', '#9F3CB3', '#A03CB3', '#A13CB3', '#A23CB3', '#A23CB3', '#A33CB2', '#A43CB2', '#A53CB2', '#A63CB2', '#A73CB2', '#A83CB2', '#A93CB2', '#A93CB2', '#AA3CB2', '#AB3CB2', '#AC3CB2', '#AD3CB2', '#AE3CB2', '#AF3CB1', '#B03CB1', '#B03CB1', '#B13CB1', '#B23CB1', '#B33CB1', '#B43CB1', '#B53CB0', '#B63CB0', '#B63CB0', '#B73CB0', '#B83CB0', '#B93CAF', '#BA3CAF', '#BB3CAF', '#BC3CAF', '
@tildebyte
tildebyte / index.html
Created December 20, 2016 17:06
playing with paperjs
<canvas id="paper-canvas" resize="true"></canvas>
@tildebyte
tildebyte / 3december-orbitingcubes-three-js.markdown
Created December 19, 2016 19:14
#3December OrbitingCubes three.js
@tildebyte
tildebyte / index.html
Created December 19, 2016 16:39
three.js template
<html lang="en">
<head>
<title>three.js webgl - helpers</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body>
</body>
</html>
@tildebyte
tildebyte / WebGL
Last active February 27, 2022 03:22
Boilerplate for three.js
/**
* @author alteredq / http://alteredqualia.com/
* @author mr.doob / http://mrdoob.com/
*/
THREE.WEBGL = {
isWebGLAvailable: function () {
try {
@tildebyte
tildebyte / utils
Last active February 27, 2022 03:21
ES6 utility functions for Codepen
// Return a value from a given range, which avoids zero, within a given tolerance.
function avoidZero(range, tolerance) {
// Return a random value in the range from `-range` to strictly less than
// `range`, excluding the inner range +/-`tolerance` (and, logically, zero as
// well).
let value = _.random(-range, range)
while (-tolerance < value && value < tolerance) {
value = _.random(-range, range)
}
return value
@tildebyte
tildebyte / range.js
Last active November 11, 2016 22:51
Damn good JS implementation of Python's `range`, using ES6 Generator.
let range = function * (start = 0, end = null, step = 1) {
if (end === null) {
end = start
start = 0
}
let value = start
while (value < end || end < value) {
yield value
value += step
}
@tildebyte
tildebyte / config.cson
Created December 3, 2015 03:06
atom config.cson
"*":
"exception-reporting":
userId: ""
welcome:
showOnStartup: false
"sync-settings":
_analyticsUserId: ""
analytics: false
personalAccessToken: ""
gistId: ""
@tildebyte
tildebyte / pypyjs_demo.html
Last active August 29, 2015 14:20
PyPy.js/p5.js experiment
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible">
<title>PyPy.js experiment</title>
<script src="http://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<!-- shim for ES6 `Promise` builtin -->
<script src="./lib/Promise.min.js" type="text/javascript"></script>