Skip to content

Instantly share code, notes, and snippets.

View sangwin's full-sized avatar
🎯
Focusing

Sangwin Gawande sangwin

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Firebase Phone Auth</title>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-auth.js"></script>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Catch the Circle Game</title>
<style>
body {
height: 100vh;
const { MongoClient, ServerApiVersion, ObjectId } = require('mongodb');
const uri = "mongodb+srv://<username>:<Password>@localhost?retryWrites=true&w=majority";
// Create a MongoClient with a MongoClientOptions object to set the Stable API version
const client = new MongoClient(uri, {
serverApi: {
version: ServerApiVersion.v1,
strict: true,
deprecationErrors: true,
}
@sangwin
sangwin / qr-code-ganarator.html
Created December 8, 2023 11:47
Sangwin| Creating QR Code
<!DOCTYPE html>
<html>
<head>
<title>Sangwin| Creating QR Code</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
</head>
<body>
<h1>Creating QR Code </h1>
<br/>
class Pagination {
constructor(items, options = {}) {
this.items = items || [];
this.currentPage = options.currentPage || 1;
this.itemsPerPage = options.itemsPerPage || 10;
}
getTotalPages() {
return Math.ceil(this.items.length / this.itemsPerPage);
}
class Countdown {
constructor(options) {
this.targetDate = new Date(options.targetDate);
this.style = options.style || 'HH:mm:ss';
this.callback = options.callback || (() => {});
this.interval = options.interval || 1000;
this.isDescending = options.isDescending || false;
this.start();
}
@sangwin
sangwin / js-mix-it-up.html
Created November 14, 2023 11:04
Simple JS Mix It Up Example by Sangwin
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple JS Mix It Up Example by Sangwin</title>
<style>
.items-list {
display: flex;
@sangwin
sangwin / cloudinary-multiple-images-upload.js
Created July 26, 2022 04:56
Cloudinary multiple images uploading
/**
* Created By : Sangwin Gawande (https://sangw.in)
*/
import React, { useState } from 'react';
export default function ImgUpload() {
const [imageData, setImageData] = useState();
const [imageArray, setImageArray] = useState([]);
@sangwin
sangwin / tinypng-compress-images.py
Created July 19, 2022 06:49
Compress images in a folder using TinyPNG plugin in Python
import tinify
import os
tinify.key = "API_KEY"
arr = os.listdir('uncompressed')
arrLen = len(arr)
// GET SIZE OF THE DIRECTORIES
def get_size(start_path = '.'):
@sangwin
sangwin / randomColor.js
Created July 18, 2022 09:11
Generate a random color with JavaScript one liner function
const randomColor = () => `#${Math.floor(Math.random() * 0xffffff).toString(16)}`;