View html5-dnd.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Parcel Sandbox</title> | |
<meta charset="UTF-8" /> | |
</head> | |
<body> | |
<div id="app"> | |
<div class="left">Left</div> |
View 1-ExposedReferencesTable.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 UnityEngine; | |
public class ExposedReferencesTable : MonoBehaviour, IExposedPropertyTable | |
{ | |
public List<PropertyName> properties = new(); | |
public List<Object> references = new(); | |
public T Get<T>(ExposedReference<T> reference) where T : Object | |
{ |
View odin.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
class Example : MonoBehaviour { | |
// Assets only | |
[AssetsOnly] | |
public GameObject SomePrefab; | |
[AssetsOnly] | |
public List<GameObject> OnlyPrefabs; | |
// SceneObjectsOnly | |
[SceneObjectsOnly] | |
public GameObject SomeSceneObject; |
View interface-segregation.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; | |
// Interface segregation | |
interface ISimulationReporter<TResult> | |
{ | |
event Action<TResult> OnComplete; | |
} | |
interface ISimulationRunner<TInput> |
View netcode.test.ts
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
import { equal } from 'assert'; | |
import { FIRST_FRAME } from './Netcode'; | |
import { NetcodeClient } from './NetcodeClient'; | |
import { NetcodeServer } from './NetcodeServer'; | |
type UserId = 'a' | 'b'; | |
type Input = 'RUN' | null; | |
interface Entity { | |
x: number; |
View ts-mockito.ts
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
import { mock, instance, when, verify, anything } from 'ts-mockito'; | |
const mockedFoo: Foo = mock(Foo); | |
// stub method before execution | |
when(mockedFoo.getBar(3)).thenReturn('three'); | |
// Getting instance from mock | |
const foo: Foo = instance(mockedFoo); |
View esm.ts
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
const extensions = { | |
js: 'application/javascript', | |
ts: 'application/typescript', | |
jsx: 'text/jsx', | |
tsx: 'text/tsx', | |
} as const; | |
type Extensions = typeof extensions; | |
type ValidExtension = keyof Extensions; | |
type ValidMediaType = Extensions[ValidExtension]; |
View concatRegexes.js
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
const createConcatenator = escape => (...regexes) => { | |
const join = regexes | |
.map(x => (x instanceof RegExp ? regexToString(x) : escape(x))) | |
.join(""); | |
const flags = regexes | |
.map(x => x instanceof RegExp && x.flags) | |
.filter(Boolean) | |
.join(""); |
View typed-messaging.ts
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
interface Message<Type extends string | number, Data = never> { | |
type: Type; | |
data: Data; | |
} | |
type MessageData< | |
Msg extends Message<any, any>, | |
Type extends Msg['type'] | |
> = Extract<Msg, { type: Type }>['data']; |
View cached-request.js
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
let cache = null; | |
export function myCachedRequest() { | |
if (cache) { | |
return Promise.resolve(cache); | |
} | |
return fetch('potato.com/foo').then(x => { | |
cache = x; | |
return x |
NewerOlder