Skip to content

Instantly share code, notes, and snippets.

View raslan1994's full-sized avatar
πŸ‘¨β€πŸ’»
Fluttering with a Macbook

raslan1994 raslan1994

πŸ‘¨β€πŸ’»
Fluttering with a Macbook
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active December 10, 2025 13:22
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@sam016
sam016 / AllGattCharacteristics.java
Last active November 28, 2025 16:57
Bluetooth GATT Services & Characteristics
package com.sam016.vsflatomation.service.ble;
import java.util.HashMap;
import java.util.UUID;
public class AllGattCharacteristics {
private static HashMap<String, String> attributes = new HashMap();
static {
attributes.put("00002a00-0000-1000-8000-00805f9b34fb", "Device Name");
@jamesjmtaylor
jamesjmtaylor / MainActivity.kt
Last active May 7, 2024 07:57
Android Activity for Obtaining BLE Transmission Power
class MainActivity : AppCompatActivity() {
var bluetoothAdapter : BluetoothAdapter? = null
var bluetoothScanner : BluetoothLeScanner? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
rssiTextView = findViewById(R.id.rssiTextView)
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter()
@Yaffle
Yaffle / TextEncoderTextDecoder.js
Last active March 18, 2025 08:30
TextEncoder/TextDecoder polyfills for utf-8
// TextEncoder/TextDecoder polyfills for utf-8 - an implementation of TextEncoder/TextDecoder APIs
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
// You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
// Some important notes about the polyfill below:
// Native TextEncoder/TextDecoder implementation is overwritten
// String.prototype.codePointAt polyfill not included, as well as String.fromCodePoint
// TextEncoder.prototype.encode returns a regular array instead of Uint8Array
// No options (fatal of the TextDecoder constructor and stream of the TextDecoder.prototype.decode method) are supported.
// TextDecoder.prototype.decode does not valid byte sequences