Skip to content

Instantly share code, notes, and snippets.

View zoxon's full-sized avatar

Zoxon zoxon

View GitHub Profile
@sipec
sipec / index.js
Created December 14, 2024 02:17
Convert vscode theme to zed using node
const fs = require("fs");
function convertSyntaxHighlighting(tokenColors) {
const syntax = {};
const scopeMapping = {
variable: ["variable", "variable.other.readwrite", "entity.name.variable"],
"variable.builtin": ["variable.defaultLanguage", "variable"],
"variable.parameter": ["variable.parameter", "variable"],
// "variable.member": [],
@WebReflection
WebReflection / dom-libraries.md
Last active February 24, 2025 11:28
A recap of my FE / DOM related libraries

My FE/DOM Libraries

a gist to recap the current status, also available as library picker!

Minimalistic Libraries

do one thing only and do it well

  • µhtml (HTML/SVG auto-keyed and manual keyed render)
  • augmentor (hooks for anything)
  • wickedElements (custom elements without custom elements ... wait, what?)
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const { createBundleRenderer } = require('vue-server-renderer');
const clientConfig = require('./build/webpack.client.config');
const serverConfig = require('./build/webpack.server.config');
const clientCompiler = webpack(clientConfig);
const serverCompiler = webpack(serverConfig);
const app = require('express')();
const express = require('express');
const htm = require('htm');
const vhtml = require('vhtml');
// create an html`` tag function for vhtml:
const html = htm.bind(vhtml);
const App = (props) => html`
<div class="app">
<h1>This is an app</h1>
@arayaryoma
arayaryoma / index.ts
Last active June 14, 2024 07:44
[TOO OLD, ARCHIVED] How to use nanoid with TypeScript
import nanoid from 'nanoid';
console.log(nanoid());
@Rich-Harris
Rich-Harris / prepack-svelte.md
Last active May 19, 2022 11:02
Is Prepack like Svelte?

Note: I'm not involved in Prepack in any way — please correct me if I say anything incorrect below!

A few people have asked me if Prepack and Svelte are similar projects with similar goals. The answer is 'no, they're not', but let's take a moment to explore why.

What is Prepack?

Prepack describes itself as a 'partial evaluator for JavaScript'. What that means is that it will run your code in a specialised interpreter that, rather than having some effect on the world (like printing a message to the console), will track the effects that would have happened and express them more directly.

So for example if you give it this code...

Delete Git branch both locally and remotely?

git push origin --delete <branch_name>
git branch -d <branch_name>
@lukecav
lukecav / DNS Prefetch domains
Last active October 9, 2024 00:30
WP Rocket - Advanced Options Prefetch DNS requests examples
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
@LoyEgor
LoyEgor / gulpfile.js
Last active March 13, 2023 17:22
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.js
@jtulk
jtulk / index.js
Created December 29, 2016 17:56
A more efficient reducer for adding/editing/removing objects in an array using a hash table
const initialState = {
byId: ['1', '2', '3'],
byHash: {
'1': {id: '1', content: {title: 'item 1'}},
'2': {id: '2', content: {title: 'item 2'}},
'3': {id: '3', content: {title: 'item 3'}}
}
}
const action1 = {