Skip to content

Instantly share code, notes, and snippets.

View hasanuzzamanbe's full-sized avatar
👋
Hi

Hasanuzzaman Shamim hasanuzzamanbe

👋
Hi
View GitHub Profile
@hasanuzzamanbe
hasanuzzamanbe / slugToString
Created July 25, 2020 07:15
Make slug to string
function makeTitle(slug) {
var words = slug.split('-');
for (var i = 0; i < words.length; i++) {
var word = words[i];
words[i] = word.charAt(0).toUpperCase() + word.slice(1);
}
return words.join(' ');
}
// makeTitle(lorem-ipsum) expected output: Lorem Ipsum
function stringToSlug (str) {
str = str.replace(/^\s+|\s+$/g, '');
str = str.toLowerCase();
var from = 'àáäâèéëêìíïîòóöôùúüûñç·/_,:;';
var to = 'aaaaeeeeiiiioooouuuunc------';
for (var i = 0, l = from.length; i < l; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
str = str.replace(/[^a-z0-9 -]/g, '')
.replace(/\s+/g, '-')
@hasanuzzamanbe
hasanuzzamanbe / Vue Js detector on a site
Created July 16, 2020 04:28
This is how vue devtool detect vue js. Just paste this snippet on the console.
const allDom = document.querySelectorAll('*')
let el
for (let i = 0; i < all.length; i++) {
if (allDom[i].__vue__) {
el = allDom[i]
console.log(el, "This is the vue element")
break
}
}
if (el) {
@hasanuzzamanbe
hasanuzzamanbe / History|-103a0af6|entries.json
Last active October 12, 2022 10:27
Visual Studio Code Settings Sync Gist
{"version":1,"resource":"file:///Users/shamim/projects/payform/wp-content/plugins/wp-payment-form/readme.txt","entries":[{"id":"fdxp.txt","timestamp":1650026265781},{"id":"gWKa.txt","timestamp":1650026315715}]}
@hasanuzzamanbe
hasanuzzamanbe / matchAllPolyfill.js
Last active June 17, 2020 06:54
Polyfill for matchAll. example:matchAll use casse; yourString.matchAll( /your-regex/ )
// polyfill for matchAll
function matchAllPolyfill(regexPattern, sourceString) {
let output = []
let match
// make sure the pattern has the global flag
let regexPatternWithGlobal = RegExp(regexPattern, "g")
while (match = regexPatternWithGlobal.exec(sourceString)) {
delete match.input
output.push(match)
}
@hasanuzzamanbe
hasanuzzamanbe / cloudSettings
Last active June 27, 2020 09:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-01-27T07:56:21.356Z","extensionVersion":"v3.4.3"}
@hasanuzzamanbe
hasanuzzamanbe / remove-node-modules.md
Created July 2, 2019 11:45 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

  1. Create a .gitignore file in the git repository if it does not contain one

touch .gitignore 2. Open up the .gitignore and add the following line to the file

node_modules 3. Remove the node_modules folder from the git repository