Skip to content

Instantly share code, notes, and snippets.

/**
* @param {Function} kvpFn - The function used to create the mapping. Return either the value to be used as key and the entire item will be set as the value, or return a key/value pair in the format [key, value] to specify both explicitely.
* @returns {Map}
*/
Array.prototype.toMap = function(kvpFn){
return new Map(this.map(item => {
let [key,value=item] = Array.prototype.concat.apply([], [kvpFn(item)]);
return [key,value];
}));
}
@asteroidsbg
asteroidsbg / Map.prototype.toObject.js
Last active September 17, 2016 11:55 — forked from rhom6us/Map.prototype.toObject.js
Map.prototype.toObject
/**
* This will be an instance member, Observable#publish.
* @memberof Map.prototype
* @param {Object} [target] - The object that the properties derived from the map's key/value pairs will be created on.
* @returns {Object}
*/
Map.prototype.toObject = function(target = Object.create(null)) {
let props = [...this].map(kvp => {
let [key, value] = kvp;
@asteroidsbg
asteroidsbg / # droi - 2016-09-16_13-44-24.txt
Created September 16, 2016 05:47
droi on Mac OS X 10.11.6 - Homebrew build logs
Homebrew build logs for droi on Mac OS X 10.11.6
Build date: 2016-09-16 13:44:24
@asteroidsbg
asteroidsbg / 3d-profile-flip-card.markdown
Created September 27, 2016 23:16
3D Profile Flip Card

3D Profile Flip Card

These are 3D Profile Flip Cards. Click the i to flip the card. The concept started out as a hover event, but that proved challenging on a mobile device, so I opted to use a bit of js to change out classes on click/touch.

There are a variety of flip options, Y, X and Diagonal

This was inspired by Rich Bradshaw: http://css3.bradshawenterprises.com/flip/

Images were from random Google search... I apologize in advance. Maybe I'll switch it out to placekitten.

@asteroidsbg
asteroidsbg / html5-video-player-ui.markdown
Created November 9, 2017 23:08
HTML5 Video Player UI
@asteroidsbg
asteroidsbg / index.haml
Created March 23, 2018 13:11
Serpent de mer
%canvas#canvas
%div#box
%div.wrap
-100.times do
%div.c
@asteroidsbg
asteroidsbg / index.html
Last active March 23, 2018 14:27
The Last Experience
<canvas></canvas>
<!--
,--. ,--.
((O ))--((O ))
,'_`--'____`--'_`.
_: ____________ :_
| | ||::::::::::|| | |
| | ||::::::::::|| | |
| | ||::::::::::|| | |
|_| |/__________\| |_|
@asteroidsbg
asteroidsbg / index.haml
Created March 27, 2018 20:56
Solar System Explorer in CSS in Chrome
%h1.logo
Solar explorer
%span in only CSS
%input.planet9{:type => 'radio', :id => 'pluto', :name => 'planet'}
%label.pluto.menu{:for => 'pluto'}
.preview
.info
%h2
.pip
Pluto
@asteroidsbg
asteroidsbg / index.html
Last active March 28, 2018 14:37
St. Gridcent – CSS Grid, clip-path, filter, & blend-mode experiment
<div class="grid">
<h1>Angel</h1>
<div class="vincent">
<img src="https://i.pinimg.com/564x/96/ce/c2/96cec216db4a26d7ea86039479d2b65f.jpg">
</div>
<b class="cell" aria-hidden="true"></b>
<b class="cell" aria-hidden="true"></b>
<b class="cell highlight" aria-hidden="true"></b>
<b class="cell" aria-hidden="true"></b>
<b class="cell" aria-hidden="true"></b>