sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
require "./SymbolMap.i" // Diamond imports don't work | |
// import { List, null } from "./List.i" | |
// import { del, delOut, dup, dupOut } from "./Generic.i" | |
type Edge | |
type Connection | |
node pos( | |
edge: Edge, |
" Specify a directory for plugins | |
call plug#begin('~/.vim/plugged') | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'scrooloose/nerdtree' | |
"Plug 'tsony-tsonev/nerdtree-git-plugin' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'airblade/vim-gitgutter' |
import Web3 from 'web3' | |
/* | |
* 1. Check for injected web3 (mist/metamask) | |
* 2. If metamask/mist create a new web3 instance and pass on result | |
* 3. Get networkId - Now we can check the user is connected to the right network to use our dApp | |
* 4. Get user account from metamask | |
* 5. Get user balance | |
*/ |
One of the most useful things in typed programming languages is generics. Generics allows you to write code that works across multiple types while still being checkable by the compiler. Even better is that with many languages like Rust and C#, generics have a distinct performance advantage over runtime casting. However although generics are extremely useful, many programming languages that have them don't allow for convenient ways of expressing them, especially for traits/interfaces. Like in Java if you want a generic interface you are forced to use the same Name<Type1, Type2, Type3, ...> syntax that you would use for a class. However, that often leads to ugly overly-verbose code.
Here's an example: Lets say that you have two traits/interfaces Foo and Bar that depend on three subtypes and you wanted a function that takes in any implementation of both Foo and Bar and returns the first type of Foo and the third type of Bar. The traditional Rust version that is similar to o
# Caesar cipher encoding | |
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[X-ZA-W]' | |
# output: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD | |
# Caesar cipher decoding | |
echo "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" | tr '[X-ZA-W]' '[A-Z]' | |
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG | |
# Can also be adjusted to ROT13 instead |