This file contains hidden or 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 collections import defaultdict | |
class ObservableAttr: | |
class _unset: pass | |
def __init__(self, default=_unset): | |
self.default = default | |
self.name = "unnamed" | |
def __set_name__(self, cls, name): |
This file contains hidden or 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
const lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua." | |
class DndListItem extends Component { | |
render({onDragStart, children}) { | |
return ( | |
<div class="dnd-list-item" | |
draggable="true" | |
onDragStart={onDragStart}> | |
{children} | |
</div> |
This file contains hidden or 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
-- scripts/first.lua | |
myvars = {} | |
Hooks.Init = function () | |
print("first.lua Hooks.Init") | |
myvars.foo = "first foo" | |
end | |
Hooks.MonsterHit = function (e) | |
print("first.lua MonsterHit", e.monster.health) | |
garglebla() |
This file contains hidden or 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
let evt = new NotifyShardRead(); | |
evt.title = "Title for modal"; | |
evt.text = "Text for modal; | |
/* NotifyShardRead has other properties that can be left unset */ | |
let gi: GameInstance = player.GetGame(); /* any GameObject provides GetGame() -> GameInstance */ | |
GameInstance.GetUISystem(gi).QueueEvent(evt); |
This file contains hidden or 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 dataclasses import dataclass | |
class Maybe: | |
def __init__(self, value): | |
self.value = value | |
def bind(self, f): | |
if self.value is None: | |
return self |
This file contains hidden or 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
#NoEnv | |
#Warn | |
SetWorkingDir %A_ScriptDir% | |
SendMode, Input | |
SetMousedelay, 20 | |
SetMousedelay, 20, Play | |
;MoveXOffset := 43 |
This file contains hidden or 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
class Program { | |
// item name that has to be taken into account for level check | |
// string itemNameToCheck = "MyObjectBuilder_Ore/Ice"; | |
string itemNameToCheck = "Ice"; | |
// tag for blocks that will be switched off and on | |
string tag = "[TOGGLE_LEVEL]"; | |
// do not change below |
This file contains hidden or 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
function (type, props, children) { | |
// placeholder for preact h | |
return {type, props, children} | |
} | |
var ElementPropSetter = { | |
get: function(target, name, proxy) { | |
return function(...values) { | |
if (name == "class") | |
target.props.class = values.join(" ") |
This file contains hidden or 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
@{% | |
// Moo lexer documention is here: | |
// https://github.com/no-context/moo | |
const moo = require("moo") | |
const lexer = moo.compile({ | |
ws: {match: /\s+/, lineBreaks: true}, | |
literal_id: { | |
match: /#[a-zA-Z_-][a-zA-Z_0-9_-]*/, | |
value: s => s.slice(1) |
This file contains hidden or 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
/* | |
Add some structure to the `[state, dispatch]` pattern of `useReducer`. | |
`useActionReducer` provides `dispatch(action: str, data: any)`, and wraps | |
it to call `handler[action](state, data)` | |
Example object based handler: | |
const todoListHandler = { | |
text: (state, {text}) => { |