Skip to content

Instantly share code, notes, and snippets.

import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (on)
import Json.Decode as Decode
import Mouse exposing (Position)
main =
Html.program
@edew
edew / option.ts
Created November 13, 2019 11:26
TypeScript Option 1
abstract class Option<T> {
abstract map<U>(f: (value: T) => U): Option<U>;
abstract defaultValue(defaultValue: T): T;
}
class Some<T> extends Option<T> {
private value: T;
constructor(value: T) {
super();

Reverse a Linked List

Suppose we have a linked list where each node is a ListNode:

class ListNode {
  constructor(value) {
    this.value = value;
    this.next = null;
 }
@edew
edew / aliases.sh
Created March 13, 2020 10:56
Shell aliases I'm using as of March 2020
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
@edew
edew / clone-plugins.sh
Last active March 30, 2020 14:39
My basic vimrc. Used with vim-polyglot, vim-prettier, vim-sensible, and vim-sleuth.
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
cd ~/.vim/bundle
git clone https://github.com/sheerun/vim-polyglot > /dev/null 2>&1
git clone https://github.com/prettier/vim-prettier > /dev/null 2>&1
git clone https://github.com/tpope/vim-sensible > /dev/null 2>&1
git clone https://github.com/tpope/vim-sleuth > /dev/null 2>&1
@edew
edew / LruCache.js
Created June 6, 2020 10:08
LruCache doodle
console.clear()
class ListNode {
constructor(key, value) {
this.key = key
this.value = value
this.next = null
this.previous = null
}
console.clear()
const OPEN_ROUND = '('
const CLOSE_ROUND = ')'
const OPEN_CURLY = '{'
const CLOSE_CURLY = '}'
const OPEN_SQUARE = '['
const CLOSE_SQUARE = ']'
@edew
edew / snippet.json
Created June 25, 2020 13:16
Windows Terminal Git Bash snippet
{
"guid": "{5b8a040f-3688-43b9-90cd-2c956ca56063}",
"hidden": false,
"name": "Git Bash",
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe -i -l",
"startingDirectory" : "%USERPROFILE%",
"icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico"
}
@edew
edew / Aliases.ps1
Last active December 28, 2020 11:40
PowerShell aliases I'm using as of December 2020
function g { git @args }
function ga { git add @args }
function gb { g branch @args }
function gst { g status @args }
function glg { g log --oneline --decorate -n 20 @args }
function gp { g push @args }
function gl { g pull @args }
function gpristine { g reset --hard; if ($?) { g clean -xdf } }
function grb { g rebase @args }
function gundo { g reset HEAD~ }
@edew
edew / how_to_provide_logs.md
Last active September 11, 2023 12:13
How to get Charting Library debug logs
  1. Enable debug mode
  2. Open the chart in your web browser and reproduce your issue. For example if you have an issue when adding a Moving Average indicator then add the indicator so the logs cover the issue you are reporting.
  3. Open the browser developer console and copy ALL of the output to a text file.
  4. Share that text file with us.

output