Skip to content

Instantly share code, notes, and snippets.

@arunrreddy
arunrreddy / cache_clear.js
Created September 16, 2024 05:07
Clear Cache based on local storage key
function async deleteCaches() {
try {
const keys = await window.caches.keys();
await Promise.all(keys.map(key => caches.delete(key)));
} catch (err) {
console.log('deleteCache err: ', err);
}
}
// run this function on your app load
@arunrreddy
arunrreddy / coupon_generator.js
Created September 16, 2024 05:06
Coupon code generator
const fs = require('fs');
const pattern = /^MT[A-Z0-9]{7}$/;
const codeCount = 1000000;
const outputFile = 'codes_5.csv';
const codes = [];
const charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
const charsetLength = charset.length;
@arunrreddy
arunrreddy / index.js
Created September 16, 2024 05:05
Google auth token generator for FCM
/**
* Firebase Cloud Messaging (FCM) can be used to send messages to clients on iOS, Android and Web.
*
* This sample uses FCM to send two types of messages to clients that are subscribed to the `news`
* topic. One type of message is a simple notification message (display message). The other is
* a notification message (display notification) with platform specific customizations. For example,
* a badge is added to messages that are sent to iOS devices.
*/
const https = require('https');
const { google } = require('googleapis');
@arunrreddy
arunrreddy / runonjava17.md
Created September 16, 2024 05:04
Run on Java 17 using sdkman

Run on java 17

  • curl -s "https://get.sdkman.io" | bash
  • source "$HOME/.sdkman/bin/sdkman-init.sh"
  • sdkman 5.13.1
  • java -version
  • sdk list java
  • sdk use java 17.0.1-tem
  • mvn --version
  • sdk list maven
  • sdk use maven 3.8.4
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function handleVibration() {
window.navigator.vibrate([200, 10, 300]);
}
</script>
</head>
@arunrreddy
arunrreddy / index.html
Created March 8, 2022 09:41 — forked from kertnik05/index.html
html table cell split diagonally
<!DOCTYPE html>
<html>
<head>
<title>HTML Table Cell Split Diagonally</title>
</head>
<body>
<table>
<tr>
<td>
<div class="c1">A</div>
@arunrreddy
arunrreddy / TTSheet2HashMap.java
Created July 7, 2020 08:08 — forked from lucaslouca/TTSheet2HashMap.java
Convert a XLSX file to List<Map<String, String>>
package com.tool.main;
import java.util.List;
import java.util.Map;
public interface TTSheet2HashMap {
/****************************************** PUBLIC ********************************************/
/**
* Initiates the processing of the sheet to List<Map<String,
@arunrreddy
arunrreddy / scope.js
Created June 9, 2020 06:43
BJS Intro - Scoping in JS
function myFunction() {
var a = 10;
if (a === 10) {
var a = 30;
let b = 20;
} else {
let c = 30;
}
console.log(a);
console.log(b);
@arunrreddy
arunrreddy / index.html
Created June 9, 2020 06:18
BJS Intro - Scripts almost always are just before the end of the body tag
<html>
<head>
<title>My first website</title>
</head>
<body>
<header></header>
<main></main>
<footer></footer>
<script src="myscript1.js"></script>
<script src="myscript2.js"></script>