Skip to content

Instantly share code, notes, and snippets.

View stewart's full-sized avatar
🆗
Computer

Andrew Stewart stewart

🆗
Computer
View GitHub Profile
@stewart
stewart / xml-to-json.es6
Last active February 7, 2018 15:01
Given an XML Document, returns a (mostly) accurate JSON representation. WIP.
import _ from "lodash";
// flattens an object (recursively!), similarly to Array#flatten
// e.g. flatten({ a: { b: { c: "hello!" } } }); // => "hello!"
function flatten(object) {
const check = _.isPlainObject(object) && _.size(object) === 1;
return check ? flatten(_.values(object)[0]) : object;
}
export function parse(xml) {
<!doctype html>
<html lang="en">
<head>
<title> CMUS Remote </title>
<link href="https://fonts.googleapis.com/css?family=Cormorant+Garamond" rel="stylesheet">
<style>
/* normalize.css */
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}
build:
hugo
serve:
hugo server --watch --port=4000
clean:
rm -rf public
deploy: clean build
package main
import (
"fmt"
"sync"
)
type Counter struct {
count int
}
module.exports = {
env: {
browser: true,
es6: true
},
extends: "eslint:recommended",
parserOptions: {
sourceType: "module"
import React from "react";
import shallowEqual from "./util/shallowEqual";
const storeShape = React.PropTypes.object.isRequired;
export function createStore(reducer, initialState) {
let state = (initialState != null) ? initialState : {};
let subscriptions = [];
module Main exposing (..)
import Dom
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.Keyed as Keyed
import Json.Decode as Json
import Task
automake
awscli
bison
brotli
chromedriver
chruby
cloc
cmake
cmus
devd