Skip to content

Instantly share code, notes, and snippets.

View Angelfire's full-sized avatar
👾
Hardcore JavaScript Developer

Andrés Bedoya (SrHart) Angelfire

👾
Hardcore JavaScript Developer
View GitHub Profile
@Angelfire
Angelfire / pull_request_template.md
Created August 20, 2024 20:41
Pull request template

Description

[Provide a detailed description of the changes introduced by this pull request. Include any relevant context.]

Jira Ticket

ABC-123

Screenshots (if relevant)

@Angelfire
Angelfire / icon.html
Created April 17, 2024 16:27
Dark mode in SVG
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<style>
path {
fill: #000;
}
@media (prefers-color-scheme: dark) {
path {
fill: #fff;
}
}
@Angelfire
Angelfire / generateRandomId.ts
Created March 14, 2024 21:19
Generates a random ID with the given prefix.
/**
* Generates a random ID with the given prefix.
* @param prefix - The prefix to be added to the generated ID.
* @returns The generated random ID.
*/
export const generateRandomId = (prefix: string) =>
`${prefix}${btoa(Date.now().toString())}${btoa(
(Math.random() * 1_000_000_000_000).toString()
)}`.replace(/=+/g, "");
@Angelfire
Angelfire / deploy-prod.yml
Created March 2, 2024 14:21
Deploy dist/ to an S3 bucket
name: Deploy to Prod
on:
workflow_dispatch:
jobs:
publish-npm:
environment: prod
runs-on: ubuntu-latest
defaults:
@Angelfire
Angelfire / settings.json
Created January 29, 2024 15:43
Zed settings
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"autosave": "on_window_change",
@Angelfire
Angelfire / readDirectory.js
Created February 28, 2023 20:06
Read Directory
import fs from "fs";
function readDirectory(path, depth = 0) {
const indent = " ".repeat(depth * 2);
const files = fs.readdirSync(path);
for (const file of files) {
const filePath = `${path}/${file}`;
const stats = fs.statSync(filePath);
@Angelfire
Angelfire / rawMarkdown.js
Created February 28, 2023 19:29
Raw Markdown
function rawMarkdown(markdown) {
const regex = /(\*{1,2}|_{1,2}|`{1,3}|~{1,2}|#{1,6}|!{0,1}\[.*?\]\(.*?\)|>{1}|`{1,2}|!\[.*?\]\(.*?\))/g
const noMarkdown = markdown.replace(regex, '')
return noMarkdown
}
const markdown = `
# H1
@Angelfire
Angelfire / forEach.js
Created January 11, 2023 02:29
Callback functions
function forEach(arr, callback) {
// for each element in the arr, run the callback, passing in the element
for (let i = 0; i < arr.length; i++) {
callback(arr[i], i)
}
}
module.exports = forEach;
@Angelfire
Angelfire / deepRetrieval.js
Created January 11, 2023 01:59
Deep Retrieval
// {
// prop: {
// prop: {
// prop: 3
// }
// }
// }
// {
// prop: 3
@Angelfire
Angelfire / LinkedList.js
Last active January 11, 2023 01:40
Linked List
class LinkedList {
constructor() {
this.head = null
}
addFirst(node) {
if (this.head === null) {
this.head = node
} else {
node.next = this.head