Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
💻

Scott Humphries sscotth

🏠
💻
View GitHub Profile
@sscotth
sscotth / snippet.js
Created Jun 15, 2017
Load Script From Url
View snippet.js
(() => {
const src = 'https://cdn.jsdelivr.net/react/latest/react.min.js'
const script = document.createElement('script')
script.src = src
document.body.appendChild(script)
})()
View alphanum.js
/* alphanum.js (C) Brian Huisman
* Based on the Alphanum Algorithm by David Koelle
* The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
*
* Distributed under same license as original
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
View range.js
const range = n => [...Array(n).keys()]
@sscotth
sscotth / table2pojo.js
Last active May 1, 2017
Converts an HTML table to a plain JavaScript Object (POJO)
View table2pojo.js
[...document.querySelectorAll('tr')].slice(1).map(row=>([...document.querySelectorAll('th')].map(el=>el.textContent).reduce((obj,head,i)=>({...obj,[head]:row.querySelectorAll('td')[i].textContent}),{})))
View clone.js
const clone = thing => Array.isArray(thing) ? [...thing] : Object(thing) === thing ? {...thing} : thing
@sscotth
sscotth / formdata.js
Last active Mar 28, 2017
Form serialization to object
View formdata.js
[...new FormData(document.querySelector('form'))].reduce((o, [name, value]) => ({ ...o, [name]: value }), {})
@sscotth
sscotth / index.md
Created Mar 6, 2017
Collapsable Lists
View index.md

Example

Hello World

Woo hoo!

Foo
View new.carbide.md
@sscotth
sscotth / cell0.js
Last active Aug 31, 2016
ReactExample.carbide.com
View cell0.js
import React from 'react'
import ReactDOM from 'react-dom'
ReactDOM.render(
<h1>Hello World</h1>,
document.getElementById('root')
)
View run.js
/**
* React Static Boilerplate
* https://github.com/koistya/react-static-boilerplate
*
* Copyright © 2015-2016 Konstantin Tarkus (@koistya)
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/