Skip to content

Instantly share code, notes, and snippets.

View NickKelly1's full-sized avatar

nickk NickKelly1

  • MyEtherWallet
  • Los Angeles, California
View GitHub Profile
@NickKelly1
NickKelly1 / Docker Readme.md
Last active May 17, 2019 10:13
Personal Readme with instructions and tips for using docker

Introduction

Docker enables you to separate your applications from your infrastructure to deliver software quickly. It provides the ability to distribute inexpensive environments cross platform with ease.

Windows 10 Home Edition

To use Docker on Windows 10 Home Edition, Docker Toolbox must be used to manage the Docker environment.

The Docker Environment consists of docker, docker-compose, and docker-machine.

@NickKelly1
NickKelly1 / cl-tools.md
Last active August 24, 2019 00:07
Linux System Admin tools

Common

  • Bash Commands
    • whoami
    • uname (-a)
      • Show system and kernel
    • mount
      • Show mounted filesystems
    • date
  • uptime

sed "s///<g for global, empty for first line entry>" app.js

Basics

  • sed "s/replaceme/REPLACEMENT/g>"
  • Removing an entrty: sed "s/REMOVEME//g"
  • Removing // comments: sed "s///.*//g"

File editing

  • "Sed is a stream editor by default"
  • To modify a file, use -i flag
  "devDependencies": {
    "ts-node": "^8.1.0",
    "typescript": "^3.4.5"
  },
  "scripts": {
    "start:ts": "ts-node main2.ts",
    "start:ts:debug": "node -r ts-node/register --inspect-brk main2.ts"
  }
@NickKelly1
NickKelly1 / Google IO 2019 Cheetsheet.md
Created May 17, 2019 13:15
Google IO 2019 Cheatsheet

es6 - http://exploringjs.com/es6/

  • for-of
    • Replaces for-in
    • Supports new iteration protocol (Symbol.iterator)
    • JavaScript for (const x of iterable) {...]
    • JavaScript for (const [key, value] of Object.entries(obj)) {...}
    • "break and continue work inside for-of loops"
    • Pros
      • Normal for loops: break/continue; usable in generators
# TS Union to KV
```ts
type Tagged =
| { _t: 'a', val: 'first'}
| { _t: 'b', val: 'second'}
| { _t: 'c', val: 'third'};
type A = Tagged['_t'];
type B = {[K in Tagged['_t']]: Extract<Tagged, { _t: K }>}
fragment PageInfoFragment on PageInfo{ page pages count total more }
# Find many Accounts
query FindAccounts {
accounts(query:{limit:2 offset:0 sorts:[ { field:"id", dir: Asc } ]}){
# collection of (first 2) accounts (sorted by id)
pageInfo { ...PageInfoFragment }
can { show create }
nodes {
# an account
HTTP/1.1 200 OK
Content-Type: application/vnd.acme.account+json
Content-Length: ...
{
"account": {
"account_number": 12345,
"balance": {
"currency": "usd",
"value": 100.00
# AccountNode fields:
# type: AccountActions
can { show withdraw deposit }
# type: AccountData
data { id name balance }
# type: AccountRelations
relations {
# AccountNode fields:
# authorisation
canShow
# authorisation
canWithdraw
# authorisation
canDeposit