Skip to content

Instantly share code, notes, and snippets.

@Synvox
Synvox / spectre.css
Created June 11, 2017 04:09
Spectre v1
/*! Spectre.css | MIT License | github.com/picturepan2/spectre */html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}hr{box-sizing:content-box;height:0;overflow:visible}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0}button,input{overflow:visible}button,select{text-transform:n
@Synvox
Synvox / Instructions.md
Last active March 24, 2017 18:02
JSX Renderer

Build a JSX Renderer

Background

Writing HTML in JavaScript is a pain. In older applications a developer may use .innerHTML throughout the application to update the content of a webpage.

Here are some bad examples:

// Using jQuery:
$('<div>Hello World</div>').appendTo('body')

// Using JavaScript
{"0-0ec":{"title":"Rakotzbrucke Bridge","thumbnail":{"src":"0.jpg"},"fullsize":{"src":"0.jpg"},"description":"(Stock Image) and a travel-themed blog post on Germany. Select this post to approve.","media":"article","cost":150,"product":null,"dates":{"start":null,"end":null},"odds":{"gender":{"male":3,"female":10},"age":{"min":18},"keywords":["travel","bridge","river","park","germany","reflection","exotic","vacation","trees","hiking","serene","peaceful","green","nature","architecture","boating","fishing","photography","new zealand","bridges","art","azalea and rhododendron park kromlau","gablenz","saxony","lord of the rings","middle earth","elvish","fantasy"],"impression":{"organic":1.1,"promoted":1.32},"engagement":{"organic":0.9,"promoted":1.08},"click":{"organic":1,"promoted":1.2},"share":{"organic":0.9,"promoted":1.08},"subscription":{"organic":1,"promoted":0.8},"unsubscription":{"organic":0.1,"promoted":0.1},"conversion":{"organic":0.2,"promoted":0.2}},"link":""},"1-659":{"title":"The Eiffel Tower","thumbna
module.exports = {
entry: './index.js',
output: {
filename: './bundle.js',
path: '/'
},
module: {
rules: [
{
test: /\.js?$/,
@Synvox
Synvox / crawl.js
Created January 22, 2017 03:34
I-Know crawler
const isWeb = window.location.href.indexOf('http') !== -1
import 'whatwg-fetch'
const feathers = require('feathers/client')
const rest = require('feathers-rest/client')
const hooks = require('feathers-hooks')
const seedrandom = require('seedrandom')
const insight = require('./insight')
const app = feathers()
@Synvox
Synvox / events.js
Created October 27, 2016 17:27
RSS Activities Reader Example
const getEvents = (url='http://calendar.byui.edu/RSSFeeds.aspx?data=tq9cbc8b%2btuQeZGvCTEMSP%2bfv3SYIrjQ3VTAXA335bE0WtJCqYU4mp9MMtuSlz6MRZ4LbMUU%2fO4%3d')=>{
return new Promise((resolve, reject)=>{
fetch(url)
.then(res=>res.text()).then(function(xml) {
const doc = new DOMParser().parseFromString(xml, 'text/xml')
const activities = []
Array.prototype.slice.call(doc.getElementsByTagName('item')).forEach((item)=>{
activities.push({
title: item.querySelector('title').textContent,
@Synvox
Synvox / states.json
Created October 26, 2016 16:50
State names and svg paths
{"AL":"M608.5506065267796,316.8232513389048L606.8424920525059,315.01056398960725L610.0815162539492,314.5455335032975L615.7856910256812,314.0986533419782L621.5831852845752,313.65081144474425L621.7844156505141,313.6392760523222L627.4665595293932,313.2351420396326L628.2468416927554,313.15843909819375L635.2699156602505,312.4731787986136L635.4000157444078,312.4608914669791L642.1368227931629,311.8095947780323L646.0471891174836,311.4537720603913L646.6334153405026,313.74436862246284L647.8655454766676,318.0890083859249L648.0417086373541,318.7359983645573L648.3765040297551,319.91889308676105L649.6560319339469,324.2827156919577L650.6973611980155,328.0593442880852L651.2976229224753,330.2012174643088L651.61481768413,331.3463703224447L652.8737629451347,335.9117479034936L653.7562386388187,339.03384009828164L654.0320356652393,340.0394899161713L655.5495835328521,345.5160312935143L655.6561927525815,345.91035908878894L656.911451761034,350.26094275580465L657.9331726450495,352.4883541810933L659.0776228617447,354.9750106189646L660
@Synvox
Synvox / index.html
Created September 11, 2016 05:56
qaOopa
<main>
<canvas></canvas>
<h1>
Ryan Allred
<small>Full Stack Web Engineer</small>
</h1>
</main>
// legacy Il2 scraping
let il2 = (()=>{
let host = 'https://byui.brainhoney.com',
url = '/Frame/Component/Home',
week = 604800000,
now = Date.now()
function timeStampToDate(dateString) {
var dt = new Date();
@Synvox
Synvox / console.js
Last active June 9, 2016 01:15
Search page regex
a = a || [];document.body.textContent.match(/ ..... /gi).forEach((i)=>{a[i] = a[i]||0; a[i]++}); console.log(a)