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 MinHeap<T> | |
_size: integer | |
_items: {T} | |
_comparator: function(T, T):boolean | |
size: integer | |
metamethod __call: function(self, comparator?: function(T, T):boolean): MinHeap<T> | |
end |
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
[package] | |
name = "foo" | |
edition = "2021" | |
version = "0.1.0" | |
authors = ["Steve Vermeulen <sfvermeulen@gmail.com>"] | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
tracing = "0.1.40" |
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) |
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 |
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 |
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 |
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 |
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: |
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(): |
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
hs.urlevent.bind("reloadKarabinerConfig", function(eventName, params) | |
hs.application.launchOrFocusByBundleID("org.pqrs.Karabiner-Elements.Preferences") | |
local delay = 10 | |
hs.timer.doAfter(1, function() | |
-- Select the complex modifications tab | |
hs.eventtap.keyStroke({}, "right", delay) | |
hs.eventtap.keyStroke({}, "right", delay) | |
hs.timer.doAfter(1, function() |
NewerOlder