Skip to content

Instantly share code, notes, and snippets.

@RoySung
RoySung / serverless-s3-upload.js
Last active November 25, 2019 03:55
using serverless upload file to s3
'use strict'
const AWS = require('aws-sdk')
const Busboy = require('busboy')
const S3 = new AWS.S3()
const makeResponse = (error, result) => {
const statusCode = error && error.statusCode || 200
return {
statusCode,
@RoySung
RoySung / sw.js
Created December 23, 2018 14:44 — forked from ireade/sw.js
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@RoySung
RoySung / cloudSettings
Created November 22, 2017 08:40
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-11-22T08:40:37.182Z","extensionVersion":"v2.8.6"}
@RoySung
RoySung / index.html
Last active August 25, 2017 01:50
simple drawing bitmap by svg // source http://jsbin.com/suhimuraki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Snap.svg vs Svg.js</title>
<script src="https://rawgithub.com/adobe-webplatform/Snap.svg/master/dist/snap.svg.js"></script>
</head>
<body>
<button onclick="handleOutput()">Output</button>
<svg id="bitmap" width="1000" height="1000" ></div>
@RoySung
RoySung / index.js
Last active July 12, 2017 16:56
Npx
#!/usr/bin/env node
console.log('Success from remote gist.')
#!/usr/bin/bash
sudo apt-get install zsh
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
chsh -s /bin/zsh