Skip to content

Instantly share code, notes, and snippets.

@algosoftbd
algosoftbd / urlToEmbed.js
Last active October 30, 2020 15:46
This function can convert regular YouTube, Vimeo, Loom url to embed url.
const urlToEmbed = (url) => { // vimeo, youtube, loom
let pattern1 = /(?:http?s?:\/\/)?(?:www\.)?(?:vimeo\.com)\/?(.+)/g;
let pattern2 = /(?:http?s?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g;
let pattern3 = /(?:http?s?:\/\/)?(?:www\.)?(?:loom\.com)\/(?:share\/)?(.+)/g;
// let pattern4 = /([-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?(?:jpg|jpeg|gif|png))/gi;
let html = '';
let type = ''
@algosoftbd
algosoftbd / shurjopay_ajax_request_ostad.js
Created December 30, 2020 09:23
shurjoPay Ajax Request | Ostad
var url = "https://shurjopay.com/sp-data.php";
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("Content-Type", "application/xml");
xhr.setRequestHeader("Accept", "application/xml");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
using Lean.Gui;
[RequireComponent(typeof(Image))]
[RequireComponent(typeof(Mask))]
[RequireComponent(typeof(ScrollRect))]
const mongoose = require('mongoose')
const crypto = require('crypto')
const { ObjectId } = mongoose.Schema
const userSchema = mongoose.Schema({
name: {
type: String,
trim: true,
required: true,
max: 32
@algosoftbd
algosoftbd / Demo.js
Created October 26, 2021 06:08
WYSIWYG Rich Text Editor
import React, { useState, useEffect } from 'react'
import { Button, Input, message, Modal, Upload } from "antd";
import RichTextEditor from './RichTextEditor';
const Demo = () => {
const [values, setValues] = useState({
desc: '',
})
const { desc } = values
server {
server_name test.chillhall.com;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/test.chillhall.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.chillhall.com/privkey.pem;
client_body_buffer_size 200k;
client_max_body_size 20m;