Skip to content

Instantly share code, notes, and snippets.

View OleksandrWebLab's full-sized avatar
😎

Oleksandr OleksandrWebLab

😎
View GitHub Profile
@OleksandrWebLab
OleksandrWebLab / config.h
Created February 24, 2026 22:09
Transparent BLE proxy/bridge for JK BMS on ESP32 to extend Bluetooth range. JK BMS BLE Repeater (ESP32 + NimBLE).
#ifndef CONFIG_H
#define CONFIG_H
#define BMS_MAC_ADDRESS "aa:bb:cc:dd:ee:ff"
#define BMS_SERVICE_UUID "0000ffe0-0000-1000-8000-00805f9b34fb"
#define BMS_CHARACTERISTIC_UUID "0000ffe1-0000-1000-8000-00805f9b34fb"
#define REPEATER_NAME_SUFFIX "-Rep"
<?php
namespace App\Http\Middleware;
use App\Services\LanguageService;
use Carbon\Carbon;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\App;
@OleksandrWebLab
OleksandrWebLab / Pagination.vue
Created May 1, 2021 09:06
Pagination with scroll
<script>
export default {
props: {
mutexIsActive: {
required: true,
type: Boolean,
default: false
}
},
data() {
@OleksandrWebLab
OleksandrWebLab / graphql.js
Created April 30, 2021 15:38
graphql and axios error handler
let graphql = axios.create({
baseURL: process.env.MIX_API_URL + '/graphql',
headers: {'Accept': 'application/json'}
})
graphql.interceptors.request.use(request => {
request.headers['Authorization'] = getToken()
return request
}, error => {
<?php
/**
* Calculates the great-circle distance between two points, with
* the Haversine formula.
*
* @param float $latitudeFrom Latitude of start point in [deg decimal]
* @param float $longitudeFrom Longitude of start point in [deg decimal]
* @param float $latitudeTo Latitude of target point in [deg decimal]
* @param float $longitudeTo Longitude of target point in [deg decimal]
<script>
function polygonArea(coords) {
let total = 0;
if (coords && coords.length > 0) {
total += Math.abs(ringArea(coords[0]));
for (let i = 1; i < coords.length; i++) {
total -= Math.abs(ringArea(coords[i]));
}
}
return total;