Skip to content

Instantly share code, notes, and snippets.

View vinaypuppal's full-sized avatar
🤓
Working from home

vínαч puppαl vinaypuppal

🤓
Working from home
View GitHub Profile
@cj
cj / @remix-run+dev+1.0.6.patch
Created December 14, 2021 17:09
Remix Transpile Modules
diff --git a/node_modules/@remix-run/dev/compiler.js b/node_modules/@remix-run/dev/compiler.js
index 22c5ac0..bb8ae60 100644
--- a/node_modules/@remix-run/dev/compiler.js
+++ b/node_modules/@remix-run/dev/compiler.js
@@ -352,6 +352,7 @@ async function createServerBuild(config, options) {
} // allow importing css files for bundling / hashing from node_modules.
+ if (config.transpileModules.includes(id)) return false;
if (id.endsWith(".css")) return false;
@jsjoeio
jsjoeio / index.ts
Last active July 12, 2021 14:59
Timezone related functions
import {
fromUnixTime,
format,
} from "date-fns"
/**
* Checks if a timezone string is valid or not
*
* We do this to catch typos.
*
@AggressivelyMeows
AggressivelyMeows / tardis-redirector.js
Last active June 19, 2021 02:26
A magic redirector that uses zero-width-spaces to create a secret key to your URLs. Trick people into thinking its magic with TARDIS redirector!
// Single-line install of CFW-EU (https://www.npmjs.com/package/cfw-easy-utils)
var cfweu = {};function t(e){var t="",s="0123456789abcdef";return new Uint8Array(e).forEach((e=>{t+=s[e>>4]+s[15&e]})),t}const s={uuidv4:()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))),async hashPassword(e,s){var r=(s=s||{}).salt||crypto.getRandomValues(new Uint8Array(8)),n=s.iterations||45e3;"string"==typeof r&&(r=function(e){(e=e.replace(/^0x/,"")).length%2!=0&&console.log("WARNING: expecting an even number of characters in the hexString");var t=e.match(/[G-Z\s]/i);t&&console.log("WARNING: found non-hex characters",t);var s=e.match(/[\dA-F]{2}/gi).map((function(e){return parseInt(e,16)}));return new Uint8Array(s).buffer}(r));const a=new TextEncoder("utf-8").encode(e),i=await crypto.subtle.importKey("raw",a,{name:"PBKDF2"},!1,["deriveBits","deriveKey"]),o=await crypto.subtle.deriveKey({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},i,{name:"AES-CBC",
@itsMapleLeaf
itsMapleLeaf / README.md
Last active May 24, 2024 03:53
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.
@Rich-Harris
Rich-Harris / http-apis.md
Last active November 3, 2022 09:02
Next-gen Node HTTP APIs

I saw this poll on Twitter earlier and was surprised at the result, which at the time of writing overwhelmingly favours option 1:

Screen Shot 2020-09-10 at 10 19 22 AM

I've always been of the opinion that the (req, res, next) => {} API is the worst of all possible worlds, so one of two things is happening:

  • I'm an idiot with bad opinions (very possibly!)
  • People like familiarity
async function supportsImgType(type) {
// Create
//
// <picture>
// <source srcset="data:,x" type="{type}" />
// <img />
// </picture>
//
// (where "data:,x" is just a minimal URL that is valid but doesn't trigger network)
let img = document.createElement('img');
@colllin
colllin / Readme.md
Last active February 21, 2024 14:55
FaunaDB User Token Expiration (for ABAC)

Auth0 + FaunaDB ABAC integration: How to expire Fauna user secrets.

Fauna doesn't (yet?) provide guaranteed expiration/TTL for ABAC tokens, so we need to implement it ourselves if we care about it.

What's in the box?

3 javascript functions, each of which can be imported into your project or run from the command-line using node path/to/script.js arg1 arg2 ... argN:

  1. deploy-schema.js: a javascript function for creating supporting collections and indexes in your Fauna database.
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.

@SaraVieira
SaraVieira / gist file.md
Last active December 5, 2023 11:59
The Origin of Furries

In this talk we will be all discussing the origin of the furry fandom. How we will thogheter create a new furry-in-js framework. We will going over how they have changed the current fandom world, our hearts and the js world in 5 very awesome minutes! This talk is to prove a point that stars mean nothing in this case.

https://reactiveconf.com/

@ValentinFunk
ValentinFunk / NetlifyServerPushPlugin.js
Last active May 4, 2024 04:24
Webpack - Generate Netlify HTTP2 Server Push _headers File when using the HtmlWebpackPlugin
/**
* Generate a Netlify HTTP2 Server Push configuration.
*
* Options:
* - headersFile {string} path to the _headers file that should be generated (relative to your output dir)
*/
function NetlifyServerPushPlugin(options) {
this.options = options;
}