Skip to content

Instantly share code, notes, and snippets.

View jaronwanderley's full-sized avatar

Jaron Wanderley jaronwanderley

View GitHub Profile
@bcnzer
bcnzer / worker.js
Last active September 28, 2022 22:26
Example of a Cloudflare Worker and Worker KV storage used to transfer/migrate traffic to alternatively infrastructure
addEventListener('fetch', event => {
event.passThroughOnException()
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const maxBizId = await MIGRATION_SETTINGS.get('maxbizid')
const currentBusinessId = getBusinessIdFromCookie(request)
if (!maxBizId || maxBizId == 0 || !currentBusinessId) {
@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@richardblondet
richardblondet / README.md
Last active February 13, 2025 05:58
Create a simple API backend with Google App Script and a Spreadsheet

Google App Script CRUD

Inspired by this gist.

Getting Started

  1. Create a new App Script project.
  2. Paste the content of the file google-app-script-crud.gs in the default Code.gs file.
  3. Create a new Spreadsheet.
  4. Copy the Spreadsheet ID found in the URL into the variable SHEET_ID located in line 1 of your file.
@jeffposnick
jeffposnick / service-worker.js
Created September 20, 2019 00:56
Example of InjectManifest in Workbox v5
// Add any other logic here as needed.
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin';
import { CacheFirst } from 'workbox-strategies/CacheFirst';
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL';
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin';
import { NavigationRoute } from 'workbox-routing/NavigationRoute';
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
import { registerRoute } from 'workbox-routing/registerRoute';
@prb28
prb28 / mathcalc.js
Last active April 15, 2021 00:15 — forked from paiv/mathcalc.js
Expression parser in JavaScript
//
// MathCalc: a parser for basic mathematical expressions
// From here: https://paiv.github.io/blog/2016/03/23/js-calc.html
//
//
// Copyright (c) 2016, Pavel Ivashkov, github.com/paiv
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
@fanoush
fanoush / P8-SPILCD-demo.js
Last active September 22, 2021 12:33
Inline C P8 LCD DMA demo
E.kickWatchdog();
function KickWd(){
if( (typeof(BTN1)=='undefined')||(!BTN1.read()) ) E.kickWatchdog();
}
var wdint=setInterval(KickWd,2000);
E.enableWatchdog(15, false);
/*
// MIT License (c) 2020 fanoush https://github.com/fanoush
// see full license text at https://choosealicense.com/licenses/mit/
var SPI2 = E.compiledC(`
@jniac
jniac / html.js
Last active November 18, 2022 09:25
html generator based on template literals
// https://gist.github.com/jniac/1f1b8e57dbb320138af00680c090f94e
const parser = new DOMParser()
const html = (strings, ...inserts) => {
if (typeof strings === 'string') {
// html is used as a regular function, eg:
// html(`<div>${foo}</div>`)
@fanoush
fanoush / DK08.js
Last active May 27, 2021 07:49
DK08 demo
function KickWd(){
if(!BTN1.read())E.kickWatchdog();
}
var wdint=setInterval(KickWd,5000); // 5 secs
E.enableWatchdog(20, false); // 20 secs
E.kickWatchdog();
/*
// MIT License (c) 2020 fanoush https://github.com/fanoush
// see full license text at https://choosealicense.com/licenses/mit/
var SPI2 = E.compiledC(`
@thednp
thednp / flatten.js
Created August 17, 2020 09:10 — forked from timo22345/flatten.js
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
<!doctype html>
<html>
<title>Flatten.js, General SVG Flattener</title>
<head>
<script>
/*
Random path and shape generator, flattener test base: https://jsfiddle.net/fjm9423q/embedded/result/
Basic usage example: https://jsfiddle.net/nrjvmqur/embedded/result/
@erictroebs
erictroebs / Touch.cpp
Last active August 30, 2024 20:03
Arduino Micro (ATmega32U4) Ten Finger Touchscreen Example
#include "Touch.h"
#if defined(_USING_HID)
#define CONTACT_COUNT_MAXIMUM 10
#define REPORTID_TOUCH 0x04
#define LSB(v) ((v >> 8) & 0xff)
#define MSB(v) (v & 0xff)