Skip to content

Instantly share code, notes, and snippets.

@Lightnet
Lightnet / mycustomtools.py
Created April 17, 2020 17:40
SImple rig and object rebuilds.
bl_info = {
"name": "Simple My Tools b28x",
"author":"Lightnet",
"version":(0,0,1),
"blender": (2,82,0),
"location": "Object",
"category": "Object",
"warning": "",
"wiki_url": "",
}
@Lightnet
Lightnet / gunjstrustsharekeyv3.js
Last active May 4, 2020 23:20
gunjstrustsharekeyv3
/*
Self contain Sandbox Gun Module chain for auth sea.js:
Created by: Lightnet
License: MIT
Version: 3.0
Last Update:2020.05.04
Credit: amark ( https://github.com/amark/gun)
Status(Work in progress!):
@Lightnet
Lightnet / CMakeLists.txt
Created April 18, 2021 21:25
SDL 2 Project build test.
#================================================
# CMAKE BUILD
# WINDOW BUILD CURRENTLY
#================================================
cmake_minimum_required(VERSION 3.20) # FetchContent is available in 3.11+
message("CMAKE_BUILD_TYPE >>> " ${CMAKE_BUILD_TYPE})
#convert checks for deubug / release
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE STREQUAL "debug")
@Lightnet
Lightnet / CMakeLists.txt
Last active May 6, 2021 04:03
glfw3 vulkan c api
#================================================
# CMAKE BUILD
# WINDOW BUILD CURRENTLY
#================================================
cmake_minimum_required(VERSION 3.20) # FetchContent is available in 3.11+
#message("CMAKE_BUILD_TYPE >>> " ${CMAKE_BUILD_TYPE})
#convert checks for debug / release
if(CMAKE_BUILD_TYPE)
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
endif()
@Lightnet
Lightnet / gulpfile.babel.js
Created October 20, 2021 16:58
gulp 4.0.2 auto reload server watch files
// base on this links
// https://gist.github.com/webdesserts/5632955
// need this for "gulp default" to run command line
// @babel/register
import { src, dest, watch, parallel, series } from "gulp";
import {spawn} from "child_process";
import config from'./config';
@Lightnet
Lightnet / getDB.js
Created November 12, 2021 02:33
reused instance for JavaScript in nodejs
// https://www.tutorialguruji.com/javascript/reusing-database-connections-with-azure-functions-using-javascript/amp/
// https://pretagteam.com/question/reusing-database-connections-with-azure-functions-using-javascript
class DBTest{
constructor(){
this.data="test";
}
setText(params) {
this.data=params;
}
@Lightnet
Lightnet / useEvent.js
Created November 15, 2021 07:16
found simple useEvent for react
//https://atomizedobjects.com/blog/javascript/develop-2d-javascript-games-html5-react/
import { useEffect } from 'react';
export default function useEvent(event, handler) {
useEffect(() => {
// initiate the event handler
window.addEventListener(event, handler);
@Lightnet
Lightnet / reactContext.js
Created November 20, 2021 21:42
react Context Provider example
import { createContext, useContext, useMemo, useState } from "react";
// create content variable for store data
export const ForumContext = createContext();
// check Provider root level top
export function useForum(){
const context = useContext(ForumContext);
if (!context) {
throw new Error(`useForum must be used within a UserContext`)
@Lightnet
Lightnet / EventLog.js
Created February 22, 2022 19:14
React Custom Event Context
//listen to event context
import React,{ useEffect, useState } from "react";
import { useEvent } from "./EventProvider.js";
export default function EventLog(){
const [log, setLog] = useState("");
const {event} = useEvent();
@Lightnet
Lightnet / AceEditor.jsx
Last active March 6, 2022 21:36
Reactjs AceEditor.jsx simple ssr check
import React, { useEffect, useState } from "react";
export default function AceEditor(props){
const [Ace, SetAce] = useState(null);
useEffect( async()=>{
if (typeof window !== 'undefined') {//server ssr
const ReactAce = await import("react-ace"); //load in order
//await import("ace-builds/src-noconflict/mode-java"); //load in order