Skip to content

Instantly share code, notes, and snippets.

View mika76's full-sized avatar
🤖
Coding...

Mladen Mihajlović mika76

🤖
Coding...
  • Serbia
  • 11:23 (UTC +02:00)
View GitHub Profile
@marina-mosti
marina-mosti / useEmptySlotCheck.js
Last active October 22, 2024 21:29
Vue 3 check for slot with no content
import { ref, computed, onBeforeUpdate, Comment, Fragment, Text, useSlots } from 'vue'
// Adapted from https://github.com/vuejs/vue-next/blob/ca17162e377e0a0bf3fae9d92d0fdcb32084a9fe/packages/runtime-core/src/helpers/renderSlot.ts#L77
// Demo: https://play.vuejs.org/#eNqVVm1P3EYQ/iuDU+UOdNiEa0NBHE2gRE1bJVWg/RJH1Z49PhvstbW7PkDX+++d2bV9vmCIggTa3Xl7ZuaZMSvvbVX5yxq9E+9URyqrDGg0dXUWyqyoSmXgoiwqSFRZwMgP+MLqo068AoXJBEp5jkmp8O8qFgYnUGu8ykujYd3YOqNQRqXUBgq9gBlbjke/ZTuj3Y3ElItFbm1JYbwLszMKEUpgE38p8hrpfXP+BWSd53AC1k8o16E8DVwilAJdDBZVTpDoBnDK+O0JYLWyKNZk4R46VXghRYFnaXYabFvb9K1busxrY0oJb6I8i25nobcBHnpnF/wIBZ4GTo2Mes68iWc0pZtkC/9Gl5KKv2KfoRdRgCxH9bEyGZUj9E7ASlgm8ry8+92+GVXjpH2PUoxuB95v9D2/hd5fCjWqJYZeJzNCLZCAsvjy6gPe07kTFmVc56T9jPAT6jKvGaNTO69lTLB7ehbte8uRTC6u9eW9QanbpBgoa66tfugRO7i2T6W+gTv1p9aOOk1VbOnI7N1ulWYCcRu5M6jJFoKehM9b3aXrMP2/j9+N0RX7uCwq88BKF9ygboQGZL3BYHSaGN76H9NoOMkKCK0z0hOIMckkxi2G2VDIsXVmZ2sb/riZK64HOy9z9PNyMXbl3oRxM7YdzL2xJjle0283btSPARBEcOrO88WkNhYozQTeKbFwp2ti3aPdEeztUeA9+BUNqoIgabhL0aSoQNjKQaYdfCD38A/th+k
@rhysburnie
rhysburnie / useHasSlot.js
Last active January 25, 2023 13:43
vue3 determine if slot is being used (has content)
import { useSlots } from 'vue';
export default function useHasSlot() {
const slots = useSlots();
return function hasSlot(name) {
return slots[name] && !isEmptySlot(slots[name]());
};
}
function isEmptySlot(items) {
const rand = (min, max) => min + Math.floor(Math.random() * max);
class Dots {
static get inputProperties() {
return [
'--bg-color',
'--dot-color',
'--mouse-x',
'--mouse-y',
];
@superqix
superqix / glint.lua
Last active February 28, 2021 09:32
Pixel-like coin glint shader for Solar2d
-- pixel-like coin glint
-- USAGE:
-- require ("glint')
--local object = display.newImage("image.png")
--object.fill.effect = "filter.custom.glint"
--object.fill.effect.intensity = 1.0 -- how bright the glint is
--object.fill.effect.size = 0.1 -- how wide the glint is as a percent of the object
@sploders101
sploders101 / MuuriGrid.vue
Last active August 18, 2020 08:45
Array-based muuri grid
<template>
<div
ref="muuriel"
class="muuri"
>
<div
class="muuri-item"
v-for="field in value"
:muurikey="field[muurikey]"
class RightChatBubble extends CustomClipper<Path> {
@override
Path getClip(Size size) {
// TODO: implement getClip
Path path = new Path();
double factor = 10.0;
path.lineTo(0, size.height - factor);
// Curve Left bottom.
@raysan5
raysan5 / custom_game_engines_small_study.md
Last active August 10, 2025 05:15
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

WARNING: Article moved to separate repo to allow users contributions: https://github.com/raysan5/custom_game_engines

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like [Unreal](https:

--This code uses the following RGB trick
--https://gist.github.com/lucatronica/6dc7fae058440ab208d99584fe314e5c
--Setting up the RGB colors.
--Unlike the above example, we're using all 16 colors now!
--That's because we're now using the 4th bit of the color index.
--We use this bit (color 8) for the background text color.
pal({
8,11,10,140,14,12,7,
129,8,11,10,140,14,12,7,
-- In RGB displays, each pixel contains 3 subpixels for red, green and blue.
-- The intensity of each subpixel can be changed independently.
-- Mixing different intensities of each allows for a large range of colors.
-- In this program, we'll use a similar approach.
-- Except our RGB subpixels can only be on or off, which limits us to 8 colors.
-- We can treat a PICO-8 color index like an RGB pixel by treating the first 3
-- bits as flags for each RGB subpixel.
@Horusiath
Horusiath / Program.fs
Last active January 26, 2025 14:18
Toy implementation of SWIM protocol in Akkling (Akka.NET F#)
open System
open System.Threading
open Akkling
open DemoFs
[<EntryPoint>]
let main argv =
let config = """
akka.loglevel = DEBUG