Skip to content

Instantly share code, notes, and snippets.

View mbparvezme's full-sized avatar

M B Parvez (Ron) mbparvezme

View GitHub Profile
@mbparvezme
mbparvezme / _jsonPuller.md
Created April 9, 2022 08:05 — forked from jalcantarab/_jsonPuller.md
A Google apps script to pull json from a spreadsheet

JSON Puller - Google Apps Script

Transforms the data of a given Spreadsheet Sheet to JSON.

  • The frozen rows are taken as keys for the JSON.
  • The data taken for the values is only that after the frozen rows

Set up:

exportJSON(Spreadsheet) - transforms the data in the given sheet to JSON.

<?php
// LINK
// https://kvz.io/create-short-ids-with-php-like-youtube-or-tinyurl.html
echo alphaID(8503056, TRUE);
function alphaID($in, $to_num = false, $pad_up = false, $pass_key = null)
{
$out = '';
$index = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// Marge and overright two objects
export let data: DataType = {}
let D: DataType = {
name : "M B Parvez: Full-stack specialist - UI/UX developer",
title : ""
}
D = { ...D, ...data }
// Get current URL from browser
var e = window.location.href.split(/[?#]/)[0];
// Copy-column.sql
UPDATE `table1` SET
`table1`.`col` = (SELECT `table2`.`col` FORM `table2` where `table1`.`ID` = `table2`.`fid`)
// REPLACE
UPDATE table SET col = REPLACE(col,',','')
// TRIM
UPDATE table SET col = TRIM(col);
var _memberMenus = document.getElementsByTagName('button');
var _confirmed = false;
var _i = 0;
var _f = 0;
var _resetAttempted = false;
function clickMemberMenu() {
if (typeof(_memberMenus[_f]) !== 'undefined' && _memberMenus[_f].getAttribute('aria-label') == 'Member Settings') {
_resetAttempted = false;
@mbparvezme
mbparvezme / webP-to-wp.php
Last active July 4, 2021 08:09
Upload WebP image files to Wordpress
// --- TESTED WITH WordPress 5.3.2
// --- ADD BELLOW CODE TO function.php
//** Enable upload for webp image files */
function webp_upload_mimes($existing_mimes) {
$existing_mimes['webp'] = 'image/webp';
return $existing_mimes;
}
//** Enable preview / thumbnail for webp image files */
@mbparvezme
mbparvezme / number-input.html
Created March 8, 2020 20:41
HTML number input - Best practice
<input type="text" name="inputName" inputmode="numeric" pattern="[0-9]*" />
var warnings = ["First warning!! Do not try to leave or close the window.", "Last warning!! Do not try to leave or close the window.", "Sorry!! Your account locked."];
var i = 0;
window.addEventListener("mouseout", function(e) {
if (!e.relatedTarget || e.relatedTarget.nodeName == "HTML") {
i++;
if (i <= 3) {
alert(warnings[i - 1]);
if (i == 3) {
window.location.replace("http://example.com/lock-window");
}
window.addEventListener('scroll', function() {
document.querySelector('.navbar').classList.toggle('nav-transform', window.scrollY >= 50);
});
// Button/Link: #backToTopBtn
document.getElementById('backToTopBtn').addEventListener('click', () => {
var start = window.pageYOffset, startTime = null
let step = (timestamp) => {
if (!startTime) startTime = timestamp
var progress = timestamp - startTime,
percentage = Math.min(progress / 1000, 1)
window.scrollTo(0, start * (1 - percentage))
if (progress < 1000) window.requestAnimationFrame(step)