Skip to content

Instantly share code, notes, and snippets.

Stuart Runyan shrunyan

Block or report user

Report or block shrunyan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.js
const puppeteer = require('puppeteer')
const express = require('express')
const querystring = require('querystring')
const server = express()
/**
* Screenshot a url
* e.g. /screenshot?url=https://www.npmjs.com&width=800&height=600
*/
server.get('/screenshot', async (req, res) => {
@shrunyan
shrunyan / prestart.js
Created Feb 6, 2017
npm prestart script for triggering sub-app builds
View prestart.js
// @see https://strongloop.com/strongblog/modular-node-js-express/
var fs = require('fs')
var resolve = require('path').resolve
var join = require('path').join
var cp = require('child_process')
// get library path
var src = resolve(__dirname, '../src/')
@shrunyan
shrunyan / pipeline.js
Last active Aug 26, 2016
Streaming pipeline for requesting, modifying and uploading an image.
View pipeline.js
'use strict'
var http = require('http')
var request = require('request')
var gm = require('gm')
var fs = require('fs')
var FormData = require('form-data')
let r1 = request('https://upload.wikimedia.org/wikipedia/commons/e/eb/Ash_Tree_-_geograph.org.uk_-_590710.jpg')
@shrunyan
shrunyan / sniff.js
Created Aug 26, 2016
Node.js module to sniff the bytes from a stream for mimetype detection
View sniff.js
'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()
@shrunyan
shrunyan / index.js
Created May 14, 2016 — forked from anonymous/index.js
Experimenting with Koajs and the Spotify api
View index.js
'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 / dropbox-form-upload.js
Last active Aug 7, 2016
Example xhr request to post file from form to dropbox
View dropbox-form-upload.js
<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 / fu-status-middleware
Created Mar 12, 2016
troll express middlware
View fu-status-middleware
app.get('/troll', (req, res) => {res.sendStatus([200,400,500,422][Math.floor(Math.random() * 4)])})
@shrunyan
shrunyan / comic-reader.md
Created Jan 9, 2016
a comic reader which can consume multiple comic data sources
View comic-reader.md

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 / comic-publisher.md
Created Jan 9, 2016
outline for comic publishing software
View comic-publisher.md

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 / bundle.js
Created Oct 21, 2015
Riot build with Gulp, Browserify, Riotify, Babel and gulp-connect
View bundle.js
/* 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) {
You can’t perform that action at this time.