Skip to content

Instantly share code, notes, and snippets.

Samar Panda samarpanda

Block or report user

Report or block samarpanda

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
samarpanda /
Created Nov 20, 2019
Improve modern code generation
  1. Javascript optimization
  "presets": [
    ["@babel/preset-env", {
      "targets": {
        "esmodules": true
samarpanda /
Last active Nov 15, 2019
Semantic versioning using npm

#Semantic versioning using npm

Upating node package version with npm update rules are as below

  1. ^ if you write ^0.13.0 when running npm update it can update to patch and minor releases: 0.13.1, 0.14.0 and so on.
  2. ~ if you write ~0.13.0, when running npm update it can update to patch releases: 0.13.1 is ok, but 0.14.0 is not.
  3. > you accept any version higher than the one you specify
  4. >= you accept any version equal to or higher than the one you specify
  5. <= you accept any version equal or lower to the one you specify
  6. < you accept any version lower to the one you specify
  7. = you accept that exact version
samarpanda /
Created Nov 4, 2019
Keeping update with upstream source

Keeping update with upstream source

  1. git remote add upstream <url_to_origin>
  2. git remote -v
  3. git fetch upstream
  4. git checkout master
  5. git merge upstream/master
  6. git push origin master
samarpanda / after-chrome-74.js
Last active Sep 27, 2019
Anti-incognito detection in google chrome
View after-chrome-74.js
//Credit -
if("storage" in navigator && 'estimate' in{
const {usage, quota} = await;
console.log(`Using ${usage} out of ${quota} bytes.`);
if(quota < 120000000){
} else {
console.log('Not Incognito')
} else {
samarpanda / cls.js
Last active Jul 23, 2019
Measuring cumulative layout shift score
View cls.js
let cumulativeLayoutShiftScore = 0;
const observer = new PerformanceObserver((list) => {
for(const entry of list.getEntries()){
cumulativeLayoutShiftScore += entry.value;
observer.observe({entryTypes: ['layoutShift']});

Quick commands

  1. Validating gzip encryption supported by the webserver
curl -k -H "Accept-Encoding: gzip" -I

-k, --insecure Ignoring insecure request or ssl doesn't required to be validated -H Add request headers

samarpanda /
Created Jul 5, 2019
Server Load testing using apache benchmark(ab)

Apache Benchmark

ab -n 50 -c 10 -H "Accept-Encoding: gzip,deflate"

-n for number of requests -c concurrent request -H Pass any specific headers

samarpanda /
Last active May 23, 2019
Device state detection with css media queries and javascript

Custom Metric using Element Timing Origin Trial

Time To First Cat(TTFC)

Calculate time to first cat(TTFC) HTML

<img src="best_cat.jpg" elementtiming>
You can’t perform that action at this time.