Skip to content

Instantly share code, notes, and snippets.

View Sundwell's full-sized avatar

Sundwell Sundwell

View GitHub Profile
@Sundwell
Sundwell / pagination.js
Last active December 4, 2024 20:42
Paginator Raw Logic
const offsetLeft = 2
const offsetRight = 2
const maxPageCount = 5
const getPages = (totalRecords, pageSize, currentPage) => {
const totalPages = Math.ceil(totalRecords / pageSize)
if (totalPages <= maxPageCount) {
return [...Array(totalPages).keys()]
}
@Sundwell
Sundwell / callable_state_machine.gd
Created September 19, 2024 00:00
Godot nodeless state machine
class_name CallableStateMachine
var state_dictionary = {}
var current_state: String
func add_states(
normal_state_callable: Callable,
enter_state_callable: Callable = Callable(),
leave_state_callable: Callable = Callable()
@Sundwell
Sundwell / gist:5a235677102cf7201213db7807e9b8dd
Created July 4, 2023 22:22
Vue.js limit characters length
<template>
<input type="text" :value="value" @input="updateValue" />
{{value}}
</template>
<script>
import { ref } from "vue";
export default {
name: "App",