Skip to content

Instantly share code, notes, and snippets.

View zaydek's full-sized avatar
🤠
Howdy!

Z 🏴‍☠️ zaydek

🤠
Howdy!
View GitHub Profile
@sbatson5
sbatson5 / multiple-firestore-queries.js
Last active February 26, 2020 09:35
Multiple firestore queries
const firebase = require('firebase');
function getCurrentEventsByStateForAdmins(state) {
const db = firebase.firestore();
db.collection('events')
.orderBy('expirationDate', 'asc')
.where('expirationDate', '>', new Date().toISOString())
.where('state', '==', state)
.where('isAdmin', '==', true)
@lukaskleinschmidt
lukaskleinschmidt / app.scss
Last active March 3, 2025 05:06
Utility class generator like tailwindcss but in pure Sass.
@use 'sass:map';
@use 'variants' as * with (
$breakpoints: (
'small': 640px,
'medium': 768px,
'large': 1024px,
'wide': 1280px,
)
);
@dominijk
dominijk / readme.md
Last active October 19, 2024 04:40
ETL Ordnance Survey AddressBase Plus to Postgresql on a mac

Addressbase plus data loading to postgres on mac

The instructions in the official getting started are tailored to Windows and AddressBase premium. This is a simple guide for those working on mac using Addressbase Plus.

You should received a zip file with the following folder structure when unzipped;

ABFLGB_CSV
|
+-- data
|   |-- AddressBasePlus_FULL_2018-03-19_001.csv
const MarkdownArray = [
// `<Comment />`.
{ syntax: /^\/\/(.*)(?:$|\n)/,
parser: (key, [children]) => <Comment key={key} children={parseText(children)} /> },
// `<Header />`.
{ syntax: /^(#{1,6})( .*)(?:$|\n)/,
parser: (key, [open, children]) => <Header key={key} open={open} children={parseText(children)} /> },
@pngwn
pngwn / ssg.md
Last active May 30, 2024 13:33
A Simple Svelte SSG.

The Simplest Svelte Static Site Generator

Assuming you don't want to statically export a Sapper app, most of the parts to build a simple SSG for Svelte already exist. The only thing that is missing is the tooling ('only').

However, you don't need a lot to get things going: just a couple of rollup builds and a config file will get you most of the way there. Just some glue.

What follows is a bunch of rambling, half thought out thoughts on how I would probably go about this. Most of the stuff discussed here is stuff I've actually done or half done or am in the process of doing with varying degrees of success. It is something I'll be spending more time on in the future. There are other things I have done, want to do, or think would be a good idea that are not listed here as they don't fall into the scope of a simple SSG.

*Dislaimer: This is how I would build an SSG, this isn't the only way, but I like this approach as there are a bunch of compile-time optimisations you can per

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@gaearon
gaearon / uselayouteffect-ssr.md
Last active March 17, 2025 10:13
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@timoxley
timoxley / todoMachine.js
Last active July 20, 2022 19:39
XState list processing machine
export function todoMachine ({ contextKey, task, ...opts }) {
return {
...opts,
initial: 'run',
states: {
run: {
invoke: {
src: (ctx, event) => (fn) => {
const itemDone = (key) => (data) => {
fn({ type: 'itemDone', data: { key, data } })
@rikonor
rikonor / main.go
Created January 19, 2019 02:43
Server Sent Events (SSE) Example in Go
package main
import (
"fmt"
"log"
"net/http"
"sync"
"time"
)