Skip to content

Instantly share code, notes, and snippets.

View mnikn's full-sized avatar
🕳️
Strike the earth

mnikn mnikn

🕳️
Strike the earth
  • earth
View GitHub Profile
@mnikn
mnikn / pico8_utils.lua
Last active January 4, 2022 09:48
pico-8 utils
function wrap_text(content,max_count)
local lines={''}local wcount=0
for i=1,#content do
local c=sub(content,i,i)
lines[#lines]..=c
wcount+=1
if (wcount>=max_count)
then
wcount=0
lines[#lines]..='\n'
@mnikn
mnikn / shader-utils
Last active June 24, 2022 03:44
shader-utils
float rect(vec2 uv, vec2 size) {
float blur = 0.000;
// 让 size 成正比
size = 0.5 - size * 0.5;
// 先画一边
vec2 r = vec2(step(size.x, uv.x), step(size.y, uv.y));
// 再画相反的边,相乘得出相交位置就是对应的矩形
r *= vec2(step(size.x, 1.0 - uv.x), step(size.y, 1.0 - uv.y));
// x 和 y 相乘得出矩形的像素点值
return r.x * r.y;
@mnikn
mnikn / Array.gd
Last active May 29, 2022 08:00
godot utils
extends Node
class_name ArrayUtils
static func filter(arr: Array, prop: Dictionary) -> Array:
var res = []
for item in arr:
for key in prop.keys():
if prop[key] is Array and item[key] in prop[key]:
res.push_back(item)
elif (!prop[key] is Array) and prop[key] == item[key]:
import dayjs, { Dayjs } from 'dayjs';
import { get } from 'lodash';
type FormatOptions = {
reliable: boolean;
};
type BaseSchemaField = {
type: SchemaFieldType;
source?: ((parentSourceData: any, rootSourceData: any) => any) | string;