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 / 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 {
# 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)
@pankajpatel
pankajpatel / scroll.easing.js
Created March 28, 2018 09:29 — forked from SgtPooki/scroll.easing.js
ScrollTo easing
function scrollTo(Y, duration, easingFunction, callback) {
var start = Date.now(),
elem = document.documentElement.scrollTop?document.documentElement:document.body,
from = elem.scrollTop;
if(from === Y) {
callback();
return; /* Prevent scrolling to the Y point if already there */
}
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;