Skip to content

Instantly share code, notes, and snippets.

View danBamikiya's full-sized avatar
:octocat:
call me a sci-tech engineer

Dan Bamikiya danBamikiya

:octocat:
call me a sci-tech engineer
View GitHub Profile
@lacolaco
lacolaco / 1.ngx-reactify.tsx
Last active February 26, 2024 08:13
A React component to render a standalone Angular component (Angular v14.2 is required)
import { ApplicationRef, ComponentRef, createComponent, Type } from "@angular/core";
import { createApplication } from "@angular/platform-browser";
import React, { useEffect, useRef, useState } from "react";
type AnyComponentRef = ComponentRef<unknown>;
export type ReactifyProps = {
component: Type<unknown>;
inputs?: Record<string, unknown>;
};
@tylerstillwater
tylerstillwater / named-insured.bui
Last active February 17, 2022 15:11
BUI Component Example
{
"id": "named-insured",
"index": 0,
"status": "incomplete",
"graphql": {
"raw": "... raw graphql persist query ...",
"values": {
"/entity/quote_id": "1B1C579D-D6A6-4619-A726-B23911C765EF",
"/quote_id": "171D54A0-9C2A-42D4-AE6E-F55292F652A7"
}
@gaearon
gaearon / minesweeper.html
Last active October 9, 2023 12:15
minesweeper (incomplete/simplfied). stream: https://www.youtube.com/watch?v=CL01_m50TYY
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="canvas"></div>
<button id="restart">Restart</button>
<script src="minesweeper.js"></script>
<style>
* {
@mjackson
mjackson / composing-route-in-react-router-v6.md
Last active March 12, 2024 08:39
Notes on route composition in React Router v6, along with a suggested improvement you can make today to start upgrading

Composing <Route> in React Router v6

Composition of <Route> elements in React Router is changing in v6 from how it worked in v4/5 and in Reach Router. React Router v6 is the successor of both React Router v5 and Reach Router.

This document explains our rationale for making the change as well as a pattern you will want to avoid in v6 and a note on how you can start preparing your v5 app for v6 today.

Background

In React Router v5, we had an example of how you could create a element](https://github.com/remix-run/react-router/blob/320be7afe44249d5c025659bc00c3276a19f0af9/packages/react-router-dom/examples/Auth.js#L50-L52) to restrict access to certain routes on the page. This element was a simple [wrapper around an actual element that made a simple decision: is the user authenticated or not? If so, ren

@itsMapleLeaf
itsMapleLeaf / README.md
Last active July 10, 2023 18:18
Typed remix helpers

This is no longer needed! Remix's built-in types have improved significantly. But I'll keep this here for historical reasons.


Typed helpers for low-boilerplate type inference with Remix data.

  • I suffix them with *Typed so I don't accidentally import the core remix helpers.
  • This doesn't support regular Response objects to prevent accidentally using them with the typed helpers.
@addyosmani
addyosmani / demo.js
Last active April 1, 2024 09:19 — forked from itsjavi/scriptloader.js
Simple promise-based script-loader
const loader = new loadScript();
loader.load([
'//apis.google.com/js/client:platform.js?onload=startApp',
'//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.3/dropbox.min.js'
]).then(({length}) => {
console.log(`${length} scripts loaded!`);
});
@SimplGy
SimplGy / generate-nginx-config.js
Last active August 13, 2021 20:53
script that makes an nginx config for every folder in a certain dir
const { readdirSync, statSync, writeFileSync } = require('fs')
const { join } = require('path')
// ----------------------------------------- Config
const DIR = '/home/deploy/www';
const TARGET = '/home/deploy/deployNginxConfig';
const HEADER = `
# Config generated by 'generate-nginx-config.js', do not hand-edit

Re: selfies project written in CRA and PWA

  • Planning of a project

    • The project planning is mostly based on Fullstack Project Planning.

      For most of my projects, especially recently, I've been following a planning process that helps me breakdown the project into component parts that help me build more efficiently.

  • React Project Structure

@iamandrewluca
iamandrewluca / bookmarklets.md
Last active October 18, 2023 07:30
Collection of bookmarklets that I use day to day #bookmarklets
@addyosmani
addyosmani / custom-metrics.js
Created April 3, 2020 16:49
custom-metrics.js
[lcp]
const po = new PerformanceObserver(() => {});
po.observe({type: 'largest-contentful-paint', buffered: true});
const lastEntry = po.takeRecords().slice(-1)[0];
return lastEntry.renderTime || lastEntry.loadTime;
[cls]
const po = new PerformanceObserver(() => {});
po.observe({type: 'layout-shift', buffered: true});
return po.takeRecords().reduce((val, entry) => val + entry.value, 0);