Install Android SDK on macOS
https://brew.sh/
Install homebrewbrew cask install homebrew/cask-versions/adoptopenjdk8
brew cask install android-sdk
brew cask install homebrew/cask-versions/adoptopenjdk8
brew cask install android-sdk
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:
#!/bin/bash | |
# ---------------------------------------------------------------------------- | |
# "THE BEER-WARE LICENSE" (Revision 42): | |
# <k.bumsik@gmail.com> wrote this file. As long as you retain this notice you | |
# can do whatever you want with this stuff. If we meet some day, and you think | |
# this stuff is worth it, you can buy me a beer in return. - Bumsik Kim | |
# ---------------------------------------------------------------------------- | |
# Configuration | |
WIDTH=1024 # 1368 for iPad Pro |
This sample script is converted this sample script (javascript) to Google Apps Script. The point for converting is signature
as shown in the following sample script.
"/api/" + apiPath + nonce + rawBody
is encrypted using HMAC SHA-384, the data of byte array is converted to HEX.
Utilities.computeHmacSignature()
is the bytes array of the signed hexadecimal.crypto.createHmac('sha384', apiSecret).update(signature).digest('hex')
is the string of the unsigned hexadecimal.In order to achieve above, I made the method of bytesToHex()
.
This is the source code of one of my blog post. To read the full blog post please click here.
<!-- | |
Complete feature detection for ES modules. Covers: | |
1. Static import: import * from './foo.js'; | |
2. Dynamic import(): import('./foo.js').then(module => {...}); | |
Demo: http://jsbin.com/tilisaledu/1/edit?html,output | |
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help. | |
--> |
mapDispatchToProps
This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps
argument of the connect
function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps
can take.
When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:
import React, { Component } from 'react'; | |
export default function withPropsChecker(WrappedComponent) { | |
return class PropsChecker extends Component { | |
componentWillReceiveProps(nextProps) { | |
Object.keys(nextProps) | |
.filter(key => { | |
return nextProps[key] !== this.props[key]; | |
}) | |
.map(key => { |
import React from 'react'; | |
import { | |
AppState, | |
} from 'react-native'; | |
import Expo from 'expo'; | |
class App extends React.Component { | |
constructor(props) { |