Skip to content

Instantly share code, notes, and snippets.

View lazuee's full-sized avatar
:shipit:
Lazuee

John Marlo Lapiz lazuee

:shipit:
Lazuee
View GitHub Profile
{
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
"name":"Afar",
"nativeName":"Afaraf"
},
"af":{
@lazuee
lazuee / xhr.js
Created May 28, 2022 17:06 — forked from m5r/xhr.js
ES6 XHR from Mackan from Devcord Discord
function loadData(url){
return new Promise((resolve, reject) => {
let xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState === XMLHttpRequest.DONE){
if(xmlhttp.status === 200){
resolve(xmlhttp.responseText);
}else{
reject(xmlhttp.status);
}
// modified from https://github.com/PvtTyphoon/lfm-rich-presence
const rpc = require("discord-rpc");
const rp = new rpc.Client({
transport: "ipc",
});
const fetch = require("request-promise");
const prettyMilliseconds = require("pretty-ms");
function formatNumber(number) {
var x = number.split(".");