Skip to content

Instantly share code, notes, and snippets.

View danwbyrne's full-sized avatar
🌞
Focusing

Daniel Byrne danwbyrne

🌞
Focusing
View GitHub Profile
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
class BstNode {
console.log packages\neo-one-smart-contract-compiler\src\createContext.ts:132
getScriptSnapshot fileName: C:\Users\Dan\desktop\neo-one\packages\neo-one-smart-contract\src\global.d.ts
console.log packages\neo-one-smart-contract-compiler\src\createContext.ts:126
getScriptVersion fileNameIn: C:\Users\Dan\desktop\neo-one\packages\neo-one-smart-contract\src\global.d.ts
console.log packages\neo-one-smart-contract-compiler\src\createContext.ts:132
getScriptSnapshot fileName: C:\Users\Dan\desktop\neo-one\packages\neo-one-smart-contract\src\sc.d.ts
console.log packages\neo-one-smart-contract-compiler\src\createContext.ts:126
@danwbyrne
danwbyrne / Typescript-typing-recipes.md
Last active August 3, 2018 18:34
Typescript typing recipes

Useful Type Rules That Saves You Looking It Up

Reduce

let count = -1;
const array = ReadonlyArray<T>;

array.reduce<{[k in string]: T}>((acc: {[k in string]: T}, entry) => ({
  //              ^-->acc-type               ^--->acc-type
 count = count + 1;
{"name":"unhandled_rejection","level":"error","message":"Unhandled rejection. Shutting down. IO error: C:\\Users\\Dan\\AppData\\Local\\neo-one\\Data\\plugin\\neo-one-server-plugin-network\\network\\manager\\resources\\neo-one-playground-local-42ad9c06-43c8-4c93-a375-9c454a3d0380\\nodes\\neo-one-playground-local-42ad9c06-43c8-4c93-a375-9c454a3d0380-0\\chain\\data/MANIFEST-000001: The system cannot find the path specified.\r\n","labels":{"error":true,"error.kind":"Error","service":"cli","component":"cli"},"data":{},"stack":"OpenError: IO error: C:\\Users\\Dan\\AppData\\Local\\neo-one\\Data\\plugin\\neo-one-server-plugin-network\\network\\manager\\resources\\neo-one-playground-local-42ad9c06-43c8-4c93-a375-9c454a3d0380\\nodes\\neo-one-playground-local-42ad9c06-43c8-4c93-a375-9c454a3d0380-0\\chain\\data/MANIFEST-000001: The system cannot find the path specified.\r\n\n at C:\\Users\\Dan\\Desktop\\neo-one-playground\\node_modules\\levelup\\lib\\levelup.js:87:23\n at C:\\Users\\Dan\\Desktop\\neo-one-playground
import { merge, Observable, Observer } from 'rxjs';
import { distinctUntilChanged, filter, scan } from 'rxjs/internal/operators';
import { map } from 'rxjs/operators';
import { unless } from '../shared/operators';
export interface KeyEvent {
readonly keyCode: number;
}
export const keyEventStream = (
export interface Foo {}
export class Bar {
public constructor() {
//
}
public do(): Foo {
return {};
}
}
@danwbyrne
danwbyrne / Bar.ts
Last active October 12, 2018 01:23
Collisions Test Results
import { Bar, bar } from './Bar';
export function Foo(value: Bar): boolean {
if (value.fizz === bar.fizz) {
return true;
}
return false;
}
@danwbyrne
danwbyrne / RESULT.ts
Created October 25, 2018 22:27
Const Export Concatenation Example
const barInternal = 'bar';
const bangInternal = 'bang';
export const bar = barInternal;
const bang = bangInternal;
const fooInternal = 'foo';
const fizzInternal = 'fizz';
export const foo = fooInternal;
const fizz = fizzInternal;
export const newFizz = fizz;
export const newBang = bang;
@danwbyrne
danwbyrne / RESULT.ts
Created October 25, 2018 22:59
Const Dynamic Exports With Collisions
const s55 = 'bar';
const bar = s55;
const fizz = 'bang';
const sc1 = bar;
export const foo = sc1;
const fizz = 'bang';
const parent = 'parent';
@danwbyrne
danwbyrne / RESULT.ts
Created October 26, 2018 17:27
Interface Substitution Failure
import { Foo } from '/Users/danielbyrne/neo-one/packages/neo-one-typescript-concatenator/src/__data__/test-directories/interfaces/base/child.ts';
interface Bang {
readonly bang: Foo;
}
export interface Fizz {
readonly fizz: Bang;
}