Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
Nixinova / decss.js
Last active May 11, 2021
Strip all CSS from HTML source
View decss.js
// Place in devtools
function decss(html) {
return html
.replace(/<link\s+rel=('|"|\s*)stylesheet.*?>/g, '')
.replace(/style=".+?"/g, '')
basehtml = document.getElementsByTagName('html')[0]
basehtml.innerHTML = decss(basehtml.innerHTML)
Nixinova / normal-date.js
Last active May 4, 2021
Date normaliser: convert a prose date to ISO
View normal-date.js
function normalise(str, outSep = ',') {
const R = String.raw
const re = str => RegExp(
str.replace(/ /g, R`\s*`).replace(/-/g, r.sep).replace(/[DMY]/g, c => r[c.toLowerCase()]),
const monthsL = 'January February March April May June July August September October November December'.toLowerCase().split(' ')
const monthsS = => month.substr(0, 3))
Nixinova / nested-css-tokenizer.ts
Last active Mar 7, 2021
Nested CSS Tokenizer example
View nested-css-tokenizer.ts
# Try it out:
let cssOutput = `
outer1 {
prop1: true;
inner {prop2: true;}
outer2 {
prop3: false;
Nixinova / center.css
Last active Feb 25, 2021
Centering in CSS
View center.css
.grid {
display: grid;
place-items: center;
/* or */
.flex {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
Nixinova / language_id.rb
Last active Feb 8, 2021
Linguist language ID generator
View language_id.rb
#!/usr/bin/env ruby
require 'digest'
language = 'InsertLangHere' # replace with full lang name
id = Digest::SHA256.hexdigest(language).to_i(16) % (2**30 - 1)
puts id
Nixinova / inventoryTab.txt
Last active Feb 7, 2021
Valid Modcrafter parameter values
View inventoryTab.txt
# Default values for parameter 'inventoryTab'
# If the argument does not match one of the values below a custom inventory tab will be created
Nixinova /
Last active Jan 28, 2021
An example of the bare essentials for creating a Minecraft mod, adding a block and an item.
package $PACKAGE;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.block.material.Material;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
Nixinova / formatter.js
Last active Jan 18, 2021
VSCode Formatter Extension Example
View formatter.js
var vscode = require("vscode")
function activate(context) {
console.log('Formatter activated') // formatting only works once activated
const formatter = vscode.languages.registerDocumentFormattingEditProvider(
'language-id', // set this to the language ID of the language to format (the bit in brackets in the vscode language menu)
provideDocumentFormattingEdits: function (document) {
const output = document.getText()