Skip to content

Instantly share code, notes, and snippets.

View faisalnjs's full-sized avatar
:fishsticks:
Mozzarella sticks or fish sticks?

Faisal N faisalnjs

:fishsticks:
Mozzarella sticks or fish sticks?
View GitHub Profile
@faisalnjs
faisalnjs / obsessions.js
Last active February 14, 2026 02:31
Fetch your Last.fm obsessions as JSON, as there is no way to do this in the official API. Use as a CommonJS module, ES module, or as a JavaScript function.
"use strict";
const { JSDOM } = require('jsdom');
async function obsessions(username = null, existingObsessions = []) {
if (!username) {
console.error('[faisalnjs/obsessions] Last.fm username is required.');
return [];
};
try {
@faisalnjs
faisalnjs / expected-emission-lines.js
Last active December 9, 2025 06:54
Expected emission lines from H atom for given series.
// Inputs
var presets = {
lyman: {
initial: 2,
final: 1
},
balmer: {
initial: 3,
final: 2
},
@faisalnjs
faisalnjs / dates.json
Last active January 12, 2025 22:13
FaisalN.js Portfolio Projects
{
"the-divided": "",
"delistgg": "1/12/2025",
"lens-authentication": "12/24/2024",
"paw-it-forward-pet-pantry": "12/14/2024",
"dango-portal": "12/7/2024",
"mydangoid": "9/1/2024",
"faisal-n": "8/27/2024",
"aurorahub": "8/26/2024",
"dango-web-solutions": "8/3/2024",
@hagemann
hagemann / slugify.js
Last active September 4, 2024 02:45
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
accomplished
accurate
@manjeshpv
manjeshpv / passport.js
Last active July 5, 2025 14:15
Passport.js using MySQL for Authentication with Express
// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',