This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const log = (...args) => {}; //console.log(...args); | |
const isIOS = (function () { | |
return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) | |
|| (navigator.userAgent.includes('Mac') && 'ontouchend' in document); | |
})(); | |
class ScrollLocker { | |
orig = {}; | |
isLocked = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HID = require('node-hid'); | |
class Relay { | |
constructor() { | |
const devices = HID.devices(); | |
const deviceInfo = devices.find(d => d.product === 'USBRelay8'); | |
this.device = new HID.HID(deviceInfo.path); | |
} | |
set(n, on) { | |
const send = Array(9).fill(0x0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)); | |
}); | |
const lookup = { | |
"mybucket.example.com": "https://my-s3-bucket.s3.us-east-1.amazonaws.com", | |
}; | |
async function handleRequest(origRequest) { | |
const origUrl = new URL(origRequest.url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const _ = require('lodash'); | |
const PNG = require('pngjs').PNG; | |
const { promisify } = require('util'); | |
const md5File = require('md5-file'); | |
const images = [ | |
{ filename: 'graphic-gif.gif' }, | |
{ filename: 'graphic-jpg-0.jpg' }, | |
{ filename: 'graphic-jpg-76.jpg' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedMethod>DELETE</AllowedMethod> | |
<AllowedMethod>HEAD</AllowedMethod> | |
<AllowedHeader>*</AllowedHeader> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import app from 'src/api'; | |
import * as qs from 'query-string'; | |
import axios from 'axios'; | |
const settings = { | |
appId: '**************', | |
appSecret: '**************************', | |
redirectUrl: 'https://myapp.com/facebook/callback', | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://joshwright.com/tips/google-authentication-for-nodejs/ | |
import { google } from 'googleapis'; | |
const buildAuth = function () { | |
return new google.auth.OAuth2( | |
'0000000000000-xxxxxxxx.apps.googleusercontent.com', // clientId | |
'XXXXXXXXXXXXXXXXXXX', // clientSecret | |
'http://localhost:7777/google/callback', // redirect | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<h1>Foo</h1> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is a workaround for a bug on iOS which prevents iframes from | |
* knowing their size. | |
* | |
* When iframe calls `document.width`, the natural width of the content | |
* is returned instead of the iframe's width. So if the iframe is 360px | |
* wide and the body contains a 1024px image, then `document.width` will | |
* incorrectly return 1024. | |
* | |
* However, if the content is *smaller* than the iframe, then the correct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WKWebViewPanelManager.h | |
// | |
// A few helpers to easily show WKWebView alerts, confirms, and prompts. | |
// | |
// Created by Joshua Wright<@bendytree> on 11/4/15. | |
// | |
// License: MIT | |
// | |
// Inspired by: https://github.com/ShingoFukuyama/WKWebViewTips |
NewerOlder