Skip to content

Instantly share code, notes, and snippets.

View vigneshshanmugam's full-sized avatar
🏠
remote

Vignesh Shanmugam vigneshshanmugam

🏠
remote
View GitHub Profile
@vigneshshanmugam
vigneshshanmugam / oldvNew.md
Created July 29, 2015 12:09
Old Orders v New orders page

Old Orders v New Orders

First Load - No cache

Page First Paint Dom Load On Load
Old- Php 4.10 4.08 5.55
New - pJS 1.22 2.34 4.24
  • First paint is delayed in php orders. Check below
@vigneshshanmugam
vigneshshanmugam / List.md
Last active January 19, 2016 15:16
Enabling/Disabling Msite on Browsers

List of API's we should be checking

  • Service Worker
  • Push Notification
  • Fetch/ Promises Compatible Browsers
  • Background Sync
  • Different Browsers
@vigneshshanmugam
vigneshshanmugam / test.js
Created November 26, 2015 10:55
Hashcode test
'use strict';
const domain = 's3-eu-west-1.amazonaws.com';
const crypto = require('crypto');
function getMd5(str) {
return crypto.createHash('md5').update(str).digest('hex');
}
function getSha1(str) {
@vigneshshanmugam
vigneshshanmugam / Loading.md
Last active June 18, 2017 01:53
Loading CSS from Multiple endpoints

To site a working example, we have built a streaming layout service which composes the page from multiple endpoints(microservices).

<html>
<head>
    <fragment src="http://assets.domain.com" inline>
</head>
<body>
    <fragment src="http://header.domain.com">
    <fragment src="http://content.domain.com" primary>
@vigneshshanmugam
vigneshshanmugam / index.html
Last active June 2, 2016 15:15
Check if its Desktop/Mobile without using window.innerWidth
<html>
<style>
@media screen and (max-width: 1024px){
.agent {
opacity: 1 !important;
}
}
.agent {
opacity: 0;
}

Keybase proof

I hereby claim:

  • I am vigneshshanmugam on github.
  • I am vigneshh (https://keybase.io/vigneshh) on keybase.
  • I have a public key ASDHqWA__CuARSBArXZPUCAKHYbFuzu60qTjPjVcYvBHHgo

To claim this, I am signing this object:

@vigneshshanmugam
vigneshshanmugam / results.md
Last active March 17, 2020 14:52
Object.keys benchmark in v8

Before

Code

const types = {};
const typeSymbols = t => {
  // don't recompute
  if (Object.keys(types).length < 1) {
    t.TYPES.forEach(type => {
      types[type] = Symbol.for(type);
'use strict';
(function(Pipe, perf) {
if (Pipe === undefined) {
return;
}
if (!('mark' in perf && 'measure' in perf)) {
return;
}
var fragmentMap = Object.create(null);
@vigneshshanmugam
vigneshshanmugam / ispromise.js
Last active April 18, 2018 19:32
Test if a given function is promise
// From graphql-js, https://github.com/graphql/graphql-js/blob/499a75939f70c4863d44149371d6a99d57ff7c35/src/jsutils/isPromise.js#L18
function isPromiseWithBoxing(value) {
return Boolean(value && typeof value.then === "function");
}
// Tailor source - https://github.com/zalando/tailor/blob/0d930d30d6ea3936985ecf3714a3d93fa755b628/src/pipe.js#L53
function isPromiseWithoutBoxing(value) {
return (
value != null &&
typeof value === "object" &&
typeof value.then === "function"
@vigneshshanmugam
vigneshshanmugam / capture-longtasks.js
Last active February 17, 2020 21:10
Observing longtasks using performance observer
const observer = new PerformanceObserver(function(list) {
const entries = list.getEntries();
// An example entry looks something like this
const exampleEntry = {
name: "same-origin-descendant",
entryType: "longtask",
startTime: 1023.40999995591,
duration: 187.19000002602115,
attribution: [
{