View meta_ops.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn index<'gc>( | |
ctx: Context<'gc>, | |
table: Value<'gc>, | |
key: Value<'gc>, | |
) -> Result<MetaResult<'gc, 2>, TypeError> { | |
let idx = match table { | |
Value::String(_) => match ctx.state.globals.get(ctx, "string") { | |
Value::Table(string_table) => { | |
let idx = if let Some(mt) = string_table.metatable() { | |
mt.get(ctx, MetaMethod::Index) |
View Ref.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Ref<T> where T: struct | |
{ | |
T _value; | |
public Ref(T value) | |
{ | |
_value = value; | |
} | |
public T Value |
View MultiSceneSetup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using UnityEngine; | |
using UnityEditor.SceneManagement; | |
using UnityEditor; | |
using System.Collections; | |
using System.Linq; | |
public class MultiSceneSetup : ScriptableObject | |
{ |
View Teal OOP example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local record Class | |
__name:string | |
__init:function(self:Class, ...:any) | |
end | |
function setup_as_class(class:Class, name:string):any | |
class.__name = name | |
setmetatable( | |
class, { | |
__call = function(_, ...):any |
View gist:2ebe995ad7e398dc7c707a1be0c87674
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local record IFoo | |
bar: function(self:IFoo, integer):integer | |
end | |
-------------------- | |
local record Foo1 | |
bar: function(integer):integer | |
end |
View LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2021 Steven Vermeulen | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
View pod.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jsonpickle.unpickler import loadclass | |
import jsonpickle | |
import typeguard # type: ignore | |
from dataclasses import is_dataclass | |
import inspect | |
# The entire purpose of this class is just to hook into the unpickle event | |
# so that we can call validate_member_types | |
# We want to be as strict as possible when deserializing |
View MoonScriptLineNumberMap.moon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- TODO - instead of calculating this every time we should cache the map to file | |
class MoonScriptLineNumberMap | |
new: => | |
@_fileMapMap = {} | |
@_jobManager = LazyResolve('JobManager') | |
_createFileMap: (moonPath) => | |
lines = @_jobManager\executeAndWaitGetAllOutputLines("moonc -X '#{moonPath}'") | |
fileMap = {} | |
first = true |
View linq_python_examples.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert_throws(func): | |
try: | |
func() | |
except Exception: | |
return True | |
return False | |
def test_empty(): |
View ZenjectSceneLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !NOT_UNITY3D | |
using System; | |
using System.Collections; | |
using UnityEngine.SceneManagement; | |
using UnityEngine; | |
using ModestTree; | |
namespace Zenject | |
{ |
NewerOlder