Skip to content

Instantly share code, notes, and snippets.

View AlanD20's full-sized avatar
🎯
Focusing

AlanD20 AlanD20

🎯
Focusing
View GitHub Profile
@AlanD20
AlanD20 / README.md
Last active September 23, 2023 20:19
Visual Studio Code Configuration / vscode / vs code / extensions / settings

VS Code Configuration

Export VSCode Extensions:

code --list-extensions | xargs -L 1 echo code --install-extension # Unix

code --list-extensions | % { "code --install-extension $_" } # Windows PowerShell

Shortcuts:

@AlanD20
AlanD20 / hashTable.js
Created March 14, 2021 17:07
Hash Table JS
function idk(key,size){
return [...key].map(x=>33*x.charCodeAt(0)%key.length).reduce((a,c)=>c+a);
}
console.log(idk('firstName', 113))
class table{
items = new Array(113);
setItem(key, value){
const idx= idk(key, this.items.length);
@AlanD20
AlanD20 / README.md
Last active April 14, 2022 06:34
Fix latest windows 10 unreleasing ports after using it.

Release unreleased ports when Windows does not fully release them.

  • Don't forget to Restart your computer.
@AlanD20
AlanD20 / Reverse_integer.ts
Last active April 2, 2022 15:01
Reverse integer - typescript - 80ms/100ms
function reverse(x: number): number {
const nums: string[] = [...(x.toString())];
const list: number[] = [];
const negative: boolean = nums[0] == '-' ? true : false;
if (negative) nums[0] = "\0";
nums.reverse().map(digit => {
if (digit == "\0") return;
list.push(Number(digit));
})
const result = Number(negative ? '-' + list.join('') : list.join(''));
@AlanD20
AlanD20 / _reset.scss
Created April 5, 2021 08:45
CSS reset
//https://piccalil.li/blog/a-modern-css-reset
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
@AlanD20
AlanD20 / README.md
Last active April 14, 2023 09:03
Twitch Extensions Config / bttv / ffz

FFZ & BTTV Config File

<html>
<head>
<style>
*, *::after, *::before{
margin: 0;
padding: 0;
box-sizing: border-box;
}
@AlanD20
AlanD20 / mergesort.js
Last active May 2, 2022 11:16
Merge sort algorithm in javascript / python
// Testing Example
const list = [5, 2, 1, 4, 5, 2, 5, 7, 9, 8, 3]
console.log("Before Merge Sorting:");
console.log(...list);
mergeSort(list);
console.log("After Merge Sorting:");
@AlanD20
AlanD20 / Database.php
Last active August 8, 2023 20:34
PHP Custom Helper Classes
<?php
namespace App\Service;
use PDO;
use PDOStatement;
class Database
{
private string $database;
@AlanD20
AlanD20 / DictionaryLookup.md
Created June 10, 2022 12:25
Coding Problems

Algorithm Problem - Dictionary Lookup

  1. You have setup() function that accepts an array of words.
  2. Calling isInDict(word) function by passing a single string word. Returns true if it includes in the dictionary which we have initialized from setup() function.
  3. The word we pass it to isInDict() function, may have wild cards which each wild card represent a single letter.

Here is an example:

Dictionary initializatoin: