Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Building the Web

Shouvik Mitra iamshouvikmitra

👨‍💻
Building the Web
View GitHub Profile
View fetchKeepAlive.js
const url = "https://nvgs.com/analytics";
const data = JSON.stringify({
event: "checkout",
time: performance.now()
});
fetch(url, {
method: 'POST',
body: data,
keepalive: true
View sendBeaconOnPageUnload.js
document.addEventListener('visibilitychange', function logData() {
if (document.visibilityState === 'hidden') {
navigator.sendBeacon('/log', analyticsData);
}
});
@iamshouvikmitra
iamshouvikmitra / sendBeacon.js
Created Aug 8, 2021
Function Invocation Pattern with Inner Functions
View sendBeacon.js
const url = "https://nvgs.com/analytics";
const data = JSON.stringify({
event: "checkout",
time: performance.now()
});
navigator.sendBeacon(url, data);
@iamshouvikmitra
iamshouvikmitra / fip.js
Created Aug 8, 2021
Function Invocation Pattern in Javascript
View fip.js
function blog(title, body) {
this.title = title;
this.body = body;
return "function invcation pattern";
}
var output = blog("My New Blog", "Lorem Ipsum ... ");
console.log("output: ", output); // "function invcation pattern"
@iamshouvikmitra
iamshouvikmitra / cloudSettings
Last active Apr 30, 2021
VS Code Sync Settings
View cloudSettings
{"lastUpload":"2021-04-30T02:29:53.607Z","extensionVersion":"v3.4.3"}
View 1-highcharts-cheatsheet.js
// Highcharts CheatSheet Part 1.
// Create interactive charts easily for your web projects.
// Download: http://www.highcharts.com/download
// More: http://api.highcharts.com/highcharts
// 1. Installation.
// Highcharts requires two files to run, highcharts.js and either jQuery, MooTools or Prototype or the Highcharts Standalone Framework which are used for some common JavaScript tasks.
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
// <script src="https://code.highcharts.com/highcharts.js"></script>
View hybrid-inheritance,cpp
#include<iostream>
using namespace std;
class A //base class
{
public:
int i;
void data1(int j)
{
i=j;
cout<<"The result is: \t"<<i<<endl;
@iamshouvikmitra
iamshouvikmitra / test.cpp
Last active Jan 12, 2017
create a class private: Name, Roll no Protected: Subject, Branch, class Public: Function "sum" to add 5 subject marks Function show to show the marks in total
View test.cpp
#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
class Main
{
private:
char Name[20];
int roll;
protected: