Skip to content

Instantly share code, notes, and snippets.

View pankajpatel's full-sized avatar
🎯
Focusing

Pankaj Patel pankajpatel

🎯
Focusing
View GitHub Profile
@pankajpatel
pankajpatel / npm-beta-publish.md
Created April 25, 2024 08:49 — forked from adcreare/npm-beta-publish.md
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 package@0.1.120-beta.1
@pankajpatel
pankajpatel / dom-snippet.js
Last active December 3, 2021 23:30
[package-of-the-day] list extract from feedhive.io #js
copy(
[...document.querySelectorAll('tr.css-ds3kc > td:nth-child(2)')]
.map(i => i.innerText)
.map(t => t.replace('📦 Package of the Day ', ''))
.map(t => t.replace(' #100DaysOfCode', ''))
.map(t => t.replace(' npmjs.com', '###'))
.map(t => t.replace(/(###)[\w\/\.\s\-,\(\)'\@<“”"\&]*/ig, ''))
.join('\n')
)
@pankajpatel
pankajpatel / getOverlap.js
Last active January 15, 2021 12:36
Function to get the overlap between two elements
/**
* Provides the overlapping status between two elements
* based on the passed in Element objects
*
* @param {Element, Element} Element object of DOM
* @return {Boolean} overlap status or null if native object not received
*/
const isOverlapping = (e1, e2) => {
if (e1.length && e1.length > 1) {
e1 = e1[0];
@pankajpatel
pankajpatel / css-grid-bg.css
Created December 18, 2020 21:39
From Storybook
:root {
--grid-size: 10px;
--cell-amount: 10;
--grid-line-opacity: .4;
--grid-offset-x: 20px;
--grid-offset-y: 20px;
}
.with-grid-lines {
const users = require('./users');
const data = users.reduce((U, _u) => {
const u = Object.assign({}, _u);
u.friends = u.friends.reduce((F, f) => {
if (users[f] && F.indexOf(f) < 0) {
F.push(users[f].id);
}
return F;
# determine your computers local IP address
ifconfig
# scan all devices on your network (if your computer's IP is 192.168.1.49, for example)
sudo nmap -sP 192.168.1.*
# the raspbery pi may show up as manufacturer "unknown" if you are using wireless.
# Try sshing to each device you think may be the pi
ssh pi@192.168.1.144
@pankajpatel
pankajpatel / portal.js
Created August 27, 2019 14:42 — forked from mogelbrod/portal.js
Non-bubbling React Portals
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
function portalContainer() {
return document.getElementById('portal-container')
}
// Taken from https://reactjs.org/docs/events.html
const DEFAULT_EVENT_LISTENERS = [
@pankajpatel
pankajpatel / 2018-https-localhost.md
Created August 27, 2019 14:42 — forked from asciitohex/2018-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@pankajpatel
pankajpatel / meta-tags.md
Created August 27, 2019 14:41 — forked from arodu/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@pankajpatel
pankajpatel / download_flickr_image.py
Created August 27, 2019 13:26 — forked from yunjey/download_flickr_image.py
downloading images from flickr using python-flickr
# First, you should install flickrapi
# pip install flickrapi
import flickrapi
import urllib
from PIL import Image
# Flickr api access key
flickr=flickrapi.FlickrAPI('c6a2c45591d4973ff525042472446ca2', '202ffe6f387ce29b', cache=True)