Skip to content

Instantly share code, notes, and snippets.

View mustafadalga's full-sized avatar

Mustafa Dalga mustafadalga

View GitHub Profile
@mustafadalga
mustafadalga / utility-classes.scss
Created March 28, 2022 19:02
Utility Classes in heybooster project
@import "~@/scss/variables/_variables.scss";
// Color Palette
$colors: (
'primary':$primaryColor,
'accent':$accentColor,
'secondary':$secondaryColor,
'white':$whiteColor,
'black':$blackColor,
@mustafadalga
mustafadalga / max-binary-heap.js
Created April 10, 2022 12:31
Max binary heap data structure algorithm example
class MaxBinaryHeap {
constructor() {
this.values = [];
}
insert(value) {
this.values.push(value);
this.bubbleUp();
return this.values;
}
@mustafadalga
mustafadalga / min-binary-heap.js
Created April 10, 2022 12:32
Min binary heap data structure algorithm example
class MinBinaryHeap {
constructor() {
this.values = [];
}
insert(value) {
this.values.push(value);
this.bubbleUp();
return this.values;
}
@mustafadalga
mustafadalga / priority-queue.js
Created April 10, 2022 19:12
Priority Queue Binary Heap Data Structure Algorithm Example
class PriorityQueue {
constructor() {
this.values = [];
}
enqueue(priority, value) {
const newNode = new Node(priority, value);
this.values.push(newNode);
this.bubbleUp();
return this.values;
@mustafadalga
mustafadalga / hash-tables.js
Created April 23, 2022 09:42
Hash Tables data structure example
class HashTable {
constructor(size = 53) {
this.keyMap = new Array(size);
}
_hash(key) {
let total = 0;
let WEIRD_PRIME = 31;
for (let i = 0; i < Math.min(key.length, 100); i++) {
let char = key[i];
let value = char.charCodeAt(0) - 96;
@mustafadalga
mustafadalga / adjacency-list-graph.js
Created April 24, 2022 10:42
Adjacency List Graph Data Structure Example in Javascript
class Graph {
constructor() {
this.adjacencyList = {}
}
addVertex(vertex) {
if (this.adjacencyList[vertex]) return;
this.adjacencyList[vertex] = []
}
addEdge(vertex1, vertex2) {
@mustafadalga
mustafadalga / graph-traversal.js
Created May 1, 2022 16:24
Graph traversal data structure in Javascript
class Graph {
constructor() {
this.adjacencyList = {}
}
addVertex(vertex) {
if (this.adjacencyList[vertex]) return;
this.adjacencyList[vertex] = []
}
addEdge(vertex1, vertex2) {
@mustafadalga
mustafadalga / _breakpoint.scss
Last active August 10, 2022 16:20
Writing Media Queries with SCSS Mixin
$breakpoints: (
"2xs": 320px,
"xs": 480px,
"sm": 640px,
"md": 768px,
"lg": 1024px,
"xl": 1280px,
"2xl": 1440px,
"3xl": 1620px,
"4xl": 1920px,
@mustafadalga
mustafadalga / webpack.config.js
Last active November 1, 2022 06:27
webpack.config.js
var path = require('path');
var webpack = require('webpack');
const dotenv = require('dotenv');
function envVariables() {
const env = dotenv.config().parsed;
return Object.keys(env).reduce((newObject, key) => {
newObject[key] = JSON.stringify(env[key]);
@mustafadalga
mustafadalga / vite.config.js
Created October 28, 2022 16:14
vite.config.js
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
interface IAssetFileNames {
[key: string]: any;
}
interface IDefineConfig {