Skip to content

Instantly share code, notes, and snippets.

View newbornfrontender's full-sized avatar
🐣
Time to code

Infant Frontender newbornfrontender

🐣
Time to code
  • Russia
View GitHub Profile
@joshnuss
joshnuss / builder.js
Last active August 12, 2021 15:32
Builder DSL for SvelteKit responses
/*
In SvelteKit, endpoints return an object, like:
{
status: 200,
headers: {...},
body: JSON.stringify({a: 1})
}
This is an exploration into how it feels using a DSL instead. Like express and others use.
@WebReflection
WebReflection / dom-libraries.md
Last active February 6, 2024 15:50
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?)
@AlexxNB
AlexxNB / widget.md
Last active April 13, 2024 20:50
Howto make no-depends widget on Svelte and load it on the page

We should have at least three files: 'Widget.svelte', 'rollup.config.js' and 'package.json':

  1. Our widget Widget.svelte:
<script>
	export let name;
</script>

<h1>Hello {name}!</h1>
@WebReflection
WebReflection / why-i-use-web-components.md
Last active December 5, 2023 17:47
Why I use web components

Why I use web components

This is some sort of answer to recent posts regarding Web Components, where more than a few misconceptions were delivered as fact.

Let's start by defining what we are talking about.

The Web Components Umbrella

As you can read in the dedicated GitHub page, Web Components is a group of features, where each feature works already by itself, and it doesn't need other features of the group to be already usable, or useful.

[user]
email = john.smith@gmail.com
name = John Smith
[push]
default = simple
[alias]
co = checkout
ci = commit
czp = cz && git pu
st = status
@ireade
ireade / sw.js
Last active May 28, 2024 19:17
Handle broken images with the service worker
self.addEventListener('install', (e) => {
e.waitUntil(
caches.open("precache").then((cache) => cache.add("/broken.png"))
);
});
function isImage(fetchRequest) {
return fetchRequest.method === "GET" && fetchRequest.destination === "image";
}
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@neretin-trike
neretin-trike / pug.md
Last active June 20, 2024 07:31
Туториал по HTML препроцессору Pug (Jade)
@marianoviola
marianoviola / rollup.config.js
Last active April 16, 2022 05:04
Svelte style preprocessor using PostCSS
import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import buble from 'rollup-plugin-buble';
import uglify from 'rollup-plugin-uglify';
import postcss from 'postcss';
import postcssImport from 'postcss-import';
import postcssCssnext from 'postcss-cssnext';
const production = !process.env.ROLLUP_WATCH;
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active March 3, 2023 11:33
HTML Element Plus for Web Components
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {