Skip to content

Instantly share code, notes, and snippets.

View shrunyan's full-sized avatar

Stuart Runyan shrunyan

View GitHub Profile
@shrunyan
shrunyan / block-filter.css
Last active August 29, 2015 14:26 — forked from aarongustafson/block-filter.css
@supports IE TestDrive Code Samples
b {
background-color: red;
}
@media only screen {
b {
background-color: green;
}
b[class] {
background: linear-gradient( 0deg, rgb(65, 150, 44), rgb(26, 219, 73) );
@shrunyan
shrunyan / app.js
Last active January 7, 2017 14:40
Example Gulp build for Riotjs + ES6 + Browserify + Babelify + Riotify
import './app.tag'
riot.mount('#app', 'app')
@shrunyan
shrunyan / riot-todo-example.js
Last active October 21, 2015 17:47
Example of riot todo MVC
<todo>
<h3>TODO</h3>
<ul>
<li each={ item, i in items }>{ item }</li>
</ul>
<form onsubmit={ handleSubmit }>
<input type="text" />
<button>Add #{ items.length + 1 }</button>
</form>
@shrunyan
shrunyan / bundle.js
Created October 21, 2015 21:23
Riot build with Gulp, Browserify, Riotify, Babel and gulp-connect
/* global require */
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer')
var browserify = require('browserify')
var watchify = require('watchify')
var riotify = require('riotify')
var babelify = require('babelify')
module.exports = function (gulp, plugins) {
@shrunyan
shrunyan / comic-publisher.md
Created January 9, 2016 22:49
outline for comic publishing software

Comic Publisher

Draft: 1

Some of the best comic work happening now is coming from indie comic creators who are distributing their work through the web. From what I can tell they are using traditional CMSs to publish and manage their work and readership.

This document will attempt to layout ideas around an application designed specifically for comic publishers. The mantra of this app is;

To be the wordpress for comic creators

@shrunyan
shrunyan / comic-reader.md
Created January 9, 2016 22:57
a comic reader which can consume multiple comic data sources

Comic Reader

As an avid web comic reader many times I start reading a web comic and get distracted with life then forget about the website. I'd like an application that can be a single source of readership.

It should:

  • Maintain a list of comics being read
  • Maintain the state of what page I'm on
  • Provide a mechanism for comic discovery
@shrunyan
shrunyan / fu-status-middleware
Created March 12, 2016 09:12
troll express middlware
app.get('/troll', (req, res) => {res.sendStatus([200,400,500,422][Math.floor(Math.random() * 4)])})
@shrunyan
shrunyan / dropbox-form-upload.js
Last active August 7, 2016 22:42
Example xhr request to post file from form to dropbox
<form action="/" method="post" name="newsletter">
<input type="text" name="first_name" value="stuart" />
<input type="file" id="resume" />
<input type="hidden" id="dropbox" />
<input type="hidden" name="zlf" value="1" />
<button type="submit">Submit</button>
</form>
<script>
document.forms.newsletter.addEventListener('submit', function cb(evt) {
evt.preventDefault()
@shrunyan
shrunyan / index.js
Created May 14, 2016 20:11 — forked from anonymous/index.js
Experimenting with Koajs and the Spotify api
'use strict'
const koa = require('koa')
const r = require('koa-route')
const https = require('https')
const app = koa()
app.use(r.get('/search/:term', function *(term) {
const req = https.request({
method: 'get',
@shrunyan
shrunyan / sniff.js
Created August 26, 2016 20:59
Node.js module to sniff the bytes from a stream for mimetype detection
'use strict'
import stream from 'stream'
export default function sniff(rs, sniffLength = 16384) {
return new Promise((resolve, reject) => {
let buffer = Buffer.from([])
let ws = new stream.Writable()