Skip to content

Instantly share code, notes, and snippets.

View v1vendi's full-sized avatar

Ilya Komsa v1vendi

View GitHub Profile
@v1vendi
v1vendi / deact.js
Last active September 29, 2023 13:38
Micro react
var createElement = (tag, props, ...children) => {
var el
if (typeof tag === 'string') {
el = document.createElement(tag)
} else if (typeof tag === 'function') {
el = tag()
}
if (children) {
for (const child of children) {
@v1vendi
v1vendi / App.tsx
Created September 6, 2023 11:10
Minimal React component for Pureweb Unreal Engine pixel streaming
import {
PlatformNext,
UndefinedModelDefinition,
DefaultStreamerOptions,
} from '@pureweb/platform-sdk';
import {
useStreamer,
useLaunchRequest,
VideoStream,
@v1vendi
v1vendi / eos_common.py
Created July 27, 2023 19:40
Epic Online Services (EOS) SDK ctypes bindings for python example
import sys
import os
import ctypes
from enum import IntEnum
dir_path = os.path.dirname(os.path.realpath(__file__))
handle = ctypes.CDLL(dir_path + "/../SDK/Bin/libEOSSDK-Mac-Shipping.dylib")
class CtypesEnum(IntEnum):
@classmethod
@v1vendi
v1vendi / react_styling_approach.jsx
Last active July 14, 2023 12:38
Idea for react css styling approach with template strings
/**
The idea is to write CSS/SCSS in the component file, but in a form of JS template string
During build time it gets gathered in a single CSS file
As a template string it MAYBE can even be evaluated in compile time to provide dynamic styling
*/
import styles from './some_style.module.css'
// in build time it exports a style to separate css file
exportStaticStyle(`
@v1vendi
v1vendi / GameLiftGameModeExample.cpp
Created September 27, 2022 14:15
GameLiftGameServer plugin documentation
// Copyright Illia Komsa 2022. All rights reserved.
#include "GameFramework/GameModeBase.h"
#include "GameFramework/PlayerState.h"
#include "Kismet/GameplayStatics.h"
#include "GameLiftGameModeExample.generated.h"
/**
* An example PlayerSession class, that adds property to store PlayerSessionId
*/
UCLASS(Abstract)
@v1vendi
v1vendi / MySubsystem.h
Created September 16, 2022 13:00
Unreal Engine Subsystem with separate logic and configurable blueprints in settings
#pragma once
#include "Subsystems/LocalPlayerSubsystem.h"
#include "Engine/DeveloperSettings.h"
#include "MySubsystem.generated.h"
class ULocalPlayer;
UCLASS(Config=Game, defaultconfig)
@v1vendi
v1vendi / hands_table.js
Created April 27, 2020 22:03
generate poker hands table
var values = Array.from('AKQJT98765432')
// values.map(j => `${values[Math.min(i,j)]}${values[Math.max(i,j)]}${i > j ? 's' : i < j ? 'o' : ''}`).join(', ')
var result = values.map(
(_,i) => values.map(
(_,j) => `${values[Math.min(i,j)]}${values[Math.max(i,j)]}${i > j ? 's' : i < j ? 'o' : ''}`.padEnd(4)
).join('')
).join('\n')
console.log(result)
/*
from random import randrange
from ortools.algorithms import pywrapknapsack_solver
PLAYERS_COUNT = 6
PLAYERS_IN_MATCH = 6
regions = {
'eu': 0,
'na': 1,
@v1vendi
v1vendi / index.html
Last active April 10, 2023 05:42
Blender-like node editor
<title>JS node editor</title>
<link rel="stylesheet" href="style.css">
<div class=node style='left:50px; top: 50px;'>
<div class='in'>input label</div>
<div class='out'>output label</div>
</div>
<svg class=link width=50 height=127 style='left:350px;top: 95px'>
<path d="M 0 0, C 50 0, 00 127, 50 127" />
@v1vendi
v1vendi / case-insensitive-obj.js
Created February 13, 2020 12:09
Object wrapper for getting fields case-insensitively
const model = {
normalKey: 1,
coRRupTkey: 2,
innErKey: {
x: 3,
Y: 4
},
aRR: [
{ first: 5 }
]