Skip to content

Instantly share code, notes, and snippets.

View mic0ishere's full-sized avatar

Jack mic0ishere

View GitHub Profile
const dataModel = require("../models/dataModel");
const { customAlphabet: genId } = require("nanoid"); // use nanoid@3.3.4
const withoutCache = async () => {
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
const id = genId(alphabet, 6)();
const exists = await dataModel.findOne({ id });
return exists ? await withoutCache() : id;
@mic0ishere
mic0ishere / gradle-github-actions-workflow.yml
Created September 18, 2022 11:04
Workflow for building gradle artifacts using Github Actions
---
name: Java CI with Gradle
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
@mic0ishere
mic0ishere / post-server.js
Created April 16, 2022 18:53
Server for testing x-www-form-urlencoded post requests
const http = require("http");
const server = http.createServer(function (request, response) {
if (request.method == "POST") {
let body = "";
request.on("data", function (data) {
body += data;
});
request.on("end", function () {
@mic0ishere
mic0ishere / dark-theme.css
Created January 27, 2021 10:55
Dark theme by Snappercord (https://github.com/snappercord/Dark-Discord), to use with no client mods installed (see https://gist.github.com/mic0ishere/5b6dd9c3db8d0c66f69aa372ea7a48a6) before using it minify using https://cssminifier.com/
.theme-dark,
.theme-light,
:root {
--background-primary: #141414 !important;
--background-secondary: #111111 !important;
--background-secondary-alt: #292929 !important;
--background-tertiary: #0c0c0c !important;
--background-accent: #242424 !important;
--background-floating: black !important;
--background-modifier-hover: rgba(255, 255, 255, 0.01) !important;
function addStyles(styles) {
const css = document.createElement('style');
css.type = 'text/css';
if (css.styleSheet) css.styleSheet.cssText = styles;
else css.appendChild(document.createTextNode(styles));
document.getElementsByTagName("head")[0].appendChild(css);
}
addStyles("the whole theme, note that it should be minified and shouldn't contain any @include")