Skip to content

Instantly share code, notes, and snippets.

View aliemir's full-sized avatar
😶‍🌫️
Working from home

Ali Emir Şen aliemir

😶‍🌫️
Working from home
View GitHub Profile
@adcreare
adcreare / npm-beta-publish.md
Last active October 21, 2024 15:53
npm publish a beta package

Steps to publish a npm package to beta that won't be available via latest and won't auto install on ncu updates etc

  1. Ensure any compile is run npm run dist etc
  2. Modify version in package.json to the following format (match with existing verion numbers etc) "version": "0.1.120-beta.1" where beta.x is the number of those betas
  3. Publish to npm npm publish --tag beta

There are two options for install:

  • Always install beta with npm install packagename@beta
  • Install specific version with npm install [email protected]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MediaCapture and Streams API</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
@thebuilder
thebuilder / useInView.tsx
Last active January 26, 2020 00:49
useInView
/* eslint-disable react-hooks/exhaustive-deps */
import * as React from 'react'
import { observe, unobserve } from './intersection'
import { InViewHookResponse, IntersectionOptions } from './index'
type State = {
inView: boolean
entry?: IntersectionObserverEntry
}
@kevinrodriguez-io
kevinrodriguez-io / eslint-prettier-ts-react-setup.conf
Created July 29, 2019 07:23
NextJS / React ESLINT + TS + PRETTIER SETUP
// .eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'react-app',
'plugin:prettier/recommended',
],
import React from "react";
import { Link } from "react-router-dom";
export function createResource(getPromise) {
let cache = {};
let inflight = {};
let errors = {};
function load(key) {
inflight[key] = getPromise(key)
@aliemir
aliemir / validations.ts
Created March 1, 2022 12:09
simple validation functions in typescript
const emailRegexp =
/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
const alphabeticRegexp = /^[a-zA-Z\s]*$/g;
const specialsRegexp = /[`\+=\?!\]\[\$}{:\/&\\@#\|<>;]/g;
const nonNumericRegexp = /\D/g;
export const isEmail = (email?: string | number | undefined) => {
return Boolean(`${email ?? ''}`.match(emailRegexp));
};