- Package Manager: Lazy
- LSP Package Manager: Mason
- Language Parser: Treesitter
- Search Mason registry for
elixir-ls
- Add
elixir
,heex
,eex
to the languages supported for treesitter.
/** | |
* @typedef {Object} CacheResponse | |
* @property {any} data - The value that you a general call would return. | |
* @property {Object} cache - The cache store merged with the current function call. | |
*/ | |
/** | |
* Caching function or memoizer that uses a custom hashing key algo. | |
* @param {function} fn - Pure function whose value you want to cache. |
/* | |
* ====================================================== | |
* node-logger: A simple logger for nodejs | |
* ====================================================== | |
* | |
* Motivation: I noticed a logging library like winstonjs | |
* could add almost 200KBs to my bundle size (un-gzipped) | |
* for doing something as simple as this 👇🏽 | |
*/ |
commit=$(curl -s http://whatthecommit.com/ | sed "34q;d"); echo ${commit:3}; |
{ | |
"meta": { | |
"theme": "onepage" | |
}, | |
"basics": { | |
"name": "Rahul Chinta", | |
"label": "Software Engineer", | |
"image": "https://en.gravatar.com/userimage/95688745/3eae14f7c9d381287aeb609fd5177be3.png", | |
"website": "https://blog.bitsapien.dev", | |
"email": "bitsapien@gmail.com", |
#!/usr/bin/env node | |
const jwtDecode = (jwt) => console.log(Buffer.from((process.argv.slice(2)[0]).split(".")[1], "base64").toString("utf-8")); | |
jwt = process.argv.slice(2)[0] | |
jwtDecode(jwt) |
exports.jwtDecode = jwtToken => | |
JSON.parse(Buffer.from(jwtToken.split(".")[1], "base64").toString("utf-8")); | |
/* Usage: | |
* jwtDecode('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); | |
* => { | |
* "sub": "1234567890", | |
* "name": "John Doe", | |
* "iat": 1516239022 | |
* } |
/* | |
* Problem: When you want to do very basic templating with very little to no logic, for example templating a mail or an HTML. | |
*/ | |
const render = (templateData, templateHTML) => | |
Object.entries(templateData).reduce( | |
(renderedContent, dataVar) => | |
renderedContent.replace(new RegExp(`{{${dataVar[0]}}}`, 'g'), dataVar[1]), | |
templateHTML | |
); |
class Life < ApplicationRecord | |
RACES = [ | |
"Time Lord", | |
"Earthling", | |
"Dalek" | |
] | |
# constants for easy access, the race_key method is not available in this context | |
RACES.each do |race| | |
const_set(race_key(race), race) |