Skip to content

Instantly share code, notes, and snippets.

View mysticfall's full-sized avatar

Xavier Cho mysticfall

  • Green Cat Software
  • Seoul, South Korea
View GitHub Profile
from datetime import datetime, timedelta
from enum import Enum
from queue import PriorityQueue
from time import mktime
from typing import Optional
import bge
from rx.core.typing import AbsoluteTime, RelativeTime, ScheduledAction, TState
from rx.disposable import Disposable
from rx.scheduler import ScheduledItem
@mysticfall
mysticfall / patch.diff
Created January 1, 2021 07:04
Expanding supported component property types in UPBGE
diff --git a/source/blender/blenkernel/intern/python_component.c b/source/blender/blenkernel/intern/python_component.c
index f288f091f8f..d66de7ae3ed 100644
--- a/source/blender/blenkernel/intern/python_component.c
+++ b/source/blender/blenkernel/intern/python_component.c
@@ -43,6 +43,7 @@
#ifdef WITH_PYTHON
# include "Python.h"
+# include "../../python/intern/bpy_rna.h"
# include "generic/bpy_internal_import.h"
class Fixture:
value = rv.from_value(1)
doubled = rv.map(value)(ops.map(lambda v: v * 2))
numbers = rv.combine(value, doubled)(lambda o: rx.combine_latest(*o))
combined = rv.combine_latest(value, doubled)(ops.map(lambda v: f"value = {v[0]}, doubled = {v[1]}"))
zipped = rv.zip(value, doubled)(ops.map(lambda v: f"{v[0]} * 2 = {v[1]}"))
@mysticfall
mysticfall / BlendmapTest.cs
Created July 22, 2019 22:57
WIP converting generate_map.gd in C#
using System;
using System.Collections.Generic;
using static System.Linq.Enumerable;
using System.Linq;
using AlleyCat.Common;
using AlleyCat.Event;
using Godot;
using Godot.Collections;
using JetBrains.Annotations;
using LanguageExt;
@mysticfall
mysticfall / PairedEyeSight.cs
Created March 25, 2019 02:51
Snippet from initial attempt to implement the eye tracking
protected virtual void OnAnimation(float delta)
{
if (!Skeleton.FindClosestAncestor<INamed>().Exists(n => n.DisplayName == "Player"))
{
LookAt(Skeleton.FindPlayer<IHumanoid>().Map(p => p.Vision.Viewpoint));
}
EyeTrackingTarget.Iter(target =>
{
Range<float> AddRange(Range<float> range1, Range<float> range2) =>
var loader = ResourceUtils
.Load<PackedScene>("res://Data/Scenes/Character Creator.tscn")
.ToObservable(this.GetScheduler());
var progress = loader.SelectMany(v => v.LeftAsEnumerable().ToObservable());
var scene = loader.SelectMany(v => v.RightAsEnumerable().ToObservable());
progress.Subscribe(e => GD.Print($"- Progress: {e.Done} of {e.Total}"));
scene.Subscribe(s => GD.Print($"- Finished loading: {s}"));
using System;
using System.IO;
using System.Threading.Tasks;
using AlleyCat.Autowire;
using AlleyCat.Common;
using Godot;
namespace AlleyCat.IO
{
[Singleton(typeof(IResourceMonitor))]
package com.greencatsoft.greenlight.grammar
import scala.language.implicitConversions
import com.greencatsoft.greenlight.{ TestRegistry, TestReporter }
import com.greencatsoft.greenlight.grammar.ModalVerb.{ Can, Must, Should }
import com.greencatsoft.greenlight.grammar.Specification.{ CaseDescription, WhatIsExpected }
import com.greencatsoft.greenlight.grammar.Statement.{ Assertation, CaseDefinition }
import com.greencatsoft.greenlight.grammar.Verb.FollowedByNegation
import com.greencatsoft.greenlight.matcher.Matcher
package todomvc.example
import scala.scalajs.js
import scala.scalajs.js.Any.{ fromFunction1, fromString, jsArrayOps }
import scala.scalajs.js.annotation.JSExport
import org.scalajs.dom.{ Element, console }
import com.greencatsoft.angularjs.{ Attributes, Controller, ElementDirective, IsolatedScope, Requires, TemplatedDirective }
import com.greencatsoft.angularjs.core.Scope
@mysticfall
mysticfall / gist:0cad779345150ba23869
Created August 31, 2014 07:48
IsolatedScope example
object CustomerDirective extends ElementDirective with TemplateUrlProvider with IsolatedScope {
override val name = "myCustomer"
override val templateUrl = "my-customer-iso.html"
bindings ++= Seq(
"customerInfo" := "info",
"title" :@ "",
"close" :& "onClose"