View foo.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
class ThingFactory { | |
constructor(private readonly service1: Service1, private readonly service2: Service2) {} | |
make<T extends OtherThing_1 | OtherThing_2>(arg: T) { // no need to declare return value. If you want to, it's T | |
// use this.service1 and this.service2 here | |
return arg; | |
} | |
} | |
const factory = new ThingFactory(service1, service2); |
View github-markdown-linkify.user.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
// ==UserScript== | |
// @name Linkify Markdown Mentions - github.com | |
// @namespace Violentmonkey Scripts | |
// @match https://github.com/* | |
// @grant none | |
// @version 1.0 | |
// @author Madara Uchiha | |
// @description 6/10/2020, 4:29:55 PM | |
// ==/UserScript== |
View defence-noodle.txt
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
- or | = wall | |
X = door | |
L = trap | |
--- | |
|L|L... | |
X X X | |
|L|L| | |
| | | | |
|L|L| | |
X X X |
View cart.fs
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
type CartItem = string // placeholder for a more complicated type | |
type EmptyState = NoItems // don't use empty list! We want to | |
// force clients to handle this as a | |
// separate case. E.g. "you have no | |
// items in your cart" | |
type ActiveState = { UnpaidItems : CartItem list; } | |
type PaidForState = { PaidItems : CartItem list; | |
Payment : decimal} |
View Mods.txt
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
Version: 1 | |
Name: 2020-05-12 | |
Mods: | |
- Id: brrainz.harmony | |
Name: Harmony | |
- Id: automatic.startupimpact | |
Name: Startup impact | |
- Id: ludeon.rimworld | |
Name: Core | |
- Id: ludeon.rimworld.royalty |
View PrisonersNeedRecruiting3.fs
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
module PrisonersNeedRecruiting | |
open Verse | |
open RimWorld | |
let inline (!>) (x: ^a): ^b = | |
((^a or ^b): (static member op_Implicit: ^a -> ^b) x) | |
type MouseEvent = | |
| RightClick |
View PrisonersNeedRecruiting2.fs
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
module PrisonersNeedRecruiting | |
open Verse | |
open RimWorld | |
open System | |
let translate (key: string) = key.TranslateSimple() | |
let inline (!>) (x:^a) : ^b = ((^a or ^b) : (static member op_Implicit : ^a -> ^b) x) | |
type ComparablePawn(pawn: Pawn) = |
View sm.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 IEnumerable<Instruction> Transpiler(IEnumerable<Instruction> codes) | |
{ | |
var state = TranspilerState.Initial; | |
foreach (var code of codes) | |
{ | |
switch (state) | |
{ | |
case TranspilerState.Initial: | |
if (SomeCondition(code)) | |
{ |
View producer-consumer.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
class Producer { | |
start(consumer) { | |
consumer.start(this); | |
this.counter = 0; | |
this.handler = setInterval(() => consumer.data(this.counter++), 1000); | |
} | |
stop() { | |
clearInterval(this.handler); | |
} |
View webpack.base.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
// This is the interesting bit | |
module: { | |
rules: [ | |
{ | |
use: [ | |
{ | |
loader: 'awesome-typescript-loader', | |
options: { | |
transpileOnly: true, // Note, this means you ignore errors. | |
// Due to legacy, we ignore errors in TypeScript files too, DON'T DO THIS FOR TS FILES |
NewerOlder