Skip to content

Instantly share code, notes, and snippets.

View ZanzyTHEbar's full-sized avatar
👨‍💻
Doing the codes

DaOfficialWizard ZanzyTHEbar

👨‍💻
Doing the codes
View GitHub Profile
@ZanzyTHEbar
ZanzyTHEbar / Gateway.cpp
Last active September 16, 2024 11:01
ESPNow and Wifi simultaneously
// use ESP-NOW to do something based on a message from another device
// and also connect to WiFi to display a web page, deal with MQTT etc
// in this case just light an LED and get UNIX timestamp from an NTP server
// NOTE: WiFi router must be on Channel 1 for this simple version to work
// Compiled using Arduino 1.8.19, and ESP32 v2.0.2
// Compiled for board: ESP32 Dev Module
// (but running on an AI Thinker ESP-CAM since I have a bunch of them)
@ZanzyTHEbar
ZanzyTHEbar / api.tsx
Last active April 15, 2024 17:22
tauri_local_http_plugin.rs
import { removeFile, readTextFile, BaseDirectory, writeTextFile } from '@tauri-apps/api/fs'
import { getClient, ResponseType } from '@tauri-apps/api/http'
import { appConfigDir, join } from '@tauri-apps/api/path'
import { invoke, convertFileSrc } from '@tauri-apps/api/tauri'
import { createContext, useContext, createMemo, Accessor, type ParentComponent } from 'solid-js'
import { createStore, produce } from 'solid-js/store'
import { debug, error, trace, warn } from 'tauri-plugin-log-api'
import { download, upload } from 'tauri-plugin-upload-api'
import { useAppDeviceContext } from './device'
import { useAppNotificationsContext } from './notifications'
@ZanzyTHEbar
ZanzyTHEbar / logger.hpp
Created March 12, 2024 16:16
Logger using variadic templating
#pragma once
#include <algorithm>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <utilities/helpers.hpp>
class Logger {
public:
@ZanzyTHEbar
ZanzyTHEbar / error.txt
Created February 11, 2024 19:32
Room Schema Error
Expected:
TableInfo{
name='airports',
columns={
longitudeDeg=Column{name='longitudeDeg', type='REAL', affinity='4', notNull=true, primaryKeyPosition=0, defaultValue='undefined'},
elevationFt=Column{name='elevationFt', type='REAL', affinity='4', notNull=false, primaryKeyPosition=0, defaultValue='undefined'},
continent=Column{name='continent', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'},
isoRegion=Column{name='isoRegion', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'},
gpsCode=Column{name='gpsCode', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='undefined'},
keywords=Column{name='keywords', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='undefined'},
@ZanzyTHEbar
ZanzyTHEbar / index.css
Last active January 5, 2024 20:48
Solid-UI tailwindcss
@layer base {
/* This style is REQUIRED due to how kobalte handles focus-visible state */
* {
@apply outline-none [&[data-focus-visible]]:outline-white;
}
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
import { createDraggable, transformStyle } from '@thisbeyond/solid-dnd'
import { JSXElement, createSignal, type ParentComponent, onMount } from 'solid-js'
import { TabsTrigger } from '@components/ui/tabs'
import { UITab, useAppContextUI } from '@context/ui'
/* Handle Dockable using solid-dnd */
const activeTabClasses = [
'tab-active',
'drop-shadow-2xl',
@ZanzyTHEbar
ZanzyTHEbar / resizer.tsx
Last active April 28, 2024 19:17
Resizing Component in SolidJS
import { throttle } from '@solid-primitives/scheduled'
import {
splitProps,
createSignal,
createEffect,
onCleanup,
JSXElement,
type Component,
type ComponentProps,
children,
@ZanzyTHEbar
ZanzyTHEbar / index.tsx
Created August 16, 2023 23:31
solid-dnd
import {
useDragDropContext,
DragDropProvider,
DragDropSensors,
DragOverlay,
SortableProvider,
createSortable,
closestCenter,
} from '@thisbeyond/solid-dnd'
import { For, JSXElement, createSignal } from 'solid-js'
#include "StateManager.hpp"
StateManager<State_e> StateManager_Device;
StateManager<ButtonState_e> StateManager_Buttons;
StateManager<MotorState_e> StateManager_Motor;
#include <ESP8266WiFi.h> // Simple Libary for Wifi AP to use
const char WiFiAPPSK[] = "xxx"; // Set Wifi Password
const char AP_NameChar[] = "xxx"; // Set Wifi Name
#include <Hash.h> // Used for webserver
#include <ESPAsyncTCP.h> // Used for webserver
#include <ESPAsyncWebServer.h> // Used for webserver
#include <FS.h> // Used for webserver
AsyncWebServer server(80); // Create AsyncWebServer object on port 80