Skip to content

Instantly share code, notes, and snippets.

View davisml's full-sized avatar

Mark Davis davisml

View GitHub Profile
@davisml
davisml / keybase.md
Last active February 18, 2022 00:10

Keybase proof

I hereby claim:

  • I am davisml on github.
  • I am davisml (https://keybase.io/davisml) on keybase.
  • I have a public key ASDMbL0msi8uw1D4flyDmcbY7BeFHR7Afi6USLlMCHxTAwo

To claim this, I am signing this object:

@davisml
davisml / FlattenArray.js
Last active July 6, 2017 15:07
Flattens an array of arbitrarily nested arrays
// Flattens an array of arbitrarily nested arrays
function flattenArray(inputArray) {
var flattenedArray = []
inputArray.forEach(function(value) {
if (value instanceof Array) {
// Concat the flattened value if it is an array
flattenedArray = flattenedArray.concat(flatten(value))
} else {
// Push the raw value
@davisml
davisml / draftToHTML.js
Last active March 9, 2017 12:47
DraftJS block data to HTML
// AttributedString class from https://github.com/cohitre/attributedString.js
// Modifications made to support html tags & remove span wrapper from unstyled blocks
var AttributedString = (function () {
var aString
, StringRange
, RangesList
, HtmlSerializer
, plainStringSerializer
, _ = {}
, entityMap = {
@davisml
davisml / CSSJSON.md
Last active December 12, 2015 01:48

Desired CSS Output

.gradientElement { background: #999; background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000)); background: -moz-linear-gradient(top, #ccc, #000); }

CSSJSON Input

{
"name": "operator-api",
"version": "0.0.1-54",
"author": "Mark Davis <davis@metalabdesign.com>",
"description": "Socket server for Operator",
"subdomain": "operator",
"scripts": {
"start": "./app.js"
},
"repository": {