Skip to content

Instantly share code, notes, and snippets.

View farism's full-sized avatar

Faris Mustafa farism

View GitHub Profile
@farism
farism / clay.bf
Created January 31, 2025 17:01
clay-beef
using System;
using System.Diagnostics;
namespace Clay;
public static class Clay
{
[CRepr]
public struct Array<T>
{
@farism
farism / luact_gui.lua
Created June 15, 2024 18:05
Defold + Yoga + Luact
local luact = require "main.luact_defold.luact_defold"
local Button = luact.component(function(props)
return luact.Box {
on = props.on,
style = {
width = 50,
height = 50,
color = {1, 1, 1, 1},
scale = {1, 1, 1},
2023-11-16 07:05:26.339 981-1022 WindowManagerShell com.android.systemui V Transition requested: android.os.BinderProxy@511d46e TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=50 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.todo/com.dynamo.android.DefoldActivity } baseActivity=ComponentInfo{com.example.todo/com.dynamo.android.DefoldActivity} topActivity=ComponentInfo{com.example.todo/com.dynamo.android.DefoldActivity} origActivity=null realActivity=ComponentInfo{com.example.todo/com.dynamo.android.DefoldActivity} numActivities=1 lastActiveTime=2778611 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@265270f} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutout
@farism
farism / ESMLoader.mint
Created September 2, 2023 10:54
ESMLoader in mint
module ESMLoader {
fun load (name : String, imports : string) : Promise(Value) {
let {resolve, promise} =
Promise.create()
let uid =
Uid.generate()
let content =
"
@farism
farism / gist:14954a520a7ad40a55d9796a3b0fc61f
Created September 1, 2023 09:15
Mint lang 0.18 feedback
1b. Bug: lifecycle method causes with a comments but no return causes exception in compiler
```
component Main {
connect App exposing { method }
fun componentDidMount {
// foo
}
@farism
farism / viewcone.cs
Created August 18, 2023 21:15
Viewcone
using UnityEngine;
public class Viewcone : MonoBehaviour
{
static readonly int alertScaleID = Shader.PropertyToID("_AlertScale");
static readonly int farViewDistanceID = Shader.PropertyToID("_FarViewDistance");
static readonly int isAttackingID = Shader.PropertyToID("_IsAttacking");
static readonly int nearViewDistanceID = Shader.PropertyToID("_NearViewDistance");
static readonly int originYID = Shader.PropertyToID("_OriginY");
static readonly int viewAngleID = Shader.PropertyToID("_ViewAngle");
// gray = fully occluded, no enemy visibility. vertical occlusion occurs at < -4 and > +4 units.
// green = full enemy visibilty. 0 to 5 units horizontal range. -4 to 0 units vertical range.
// half green = partial enemy visibility. 5 to 30 units horizontal range. 0 to +4 units vertical range
Shader "Custom/Viewcone" {
Properties{
_Color("Color of viewcone",Color) = (1,1,1,1)
_Color2("Secondary color of viewcone",Color) = (1,1,1,1)
_WarningColor("Color of viewcone when detected",Color) = (1,1,1,1)
_AlertColor("Color of viewcone danger area",Color) = (1,1,1,1)
import * as Jsx from "../Jsx"
import { InputActionId } from "../Document"
import { SCALING_FACTOR } from "../constants"
import { color, onTick, vec3 } from "../utils"
const REPEAT_RATE = 0.075
const stylesheet: Stylesheet = {
input: {
alignItems: "stretch",
import * as Jsx from "../Jsx"
import { InputActionId } from "../Document"
import { Node } from "../Node"
import { FlexDisplay, SCALING_FACTOR } from "../constants"
import { color, merge, onTick, slice9, vec3 } from "../utils"
const stylesheet = {
container: {
grow: 1,
color: color(1, 1, 1, 1),
## create a nimble dev task
##
## task dev, "run watcher":
## exec "nim c -r watcher.nim <src> <binary>"
import osproc, os, tables, times
let
dir = if paramCount() > 0: paramStr(1) else: "src"
bin = if paramCount() > 1: paramStr(2) else: "client"