Skip to content

Instantly share code, notes, and snippets.

View ShuvoHabib's full-sized avatar

Habib ShuvoHabib

  • Deriv
  • Dhaka, Bangladesh
View GitHub Profile
@ShuvoHabib
ShuvoHabib / react-jquery.md
Created April 2, 2022 19:32
Using jQuery in React [jQuery setup in React]

Since React uses the Virtual DOM to manipulate the DOM nodes on the web page, and most other libraries might do direct DOM manipulation, variable attached to window is not directly available to all components. Thus in every component where jquery is required, a variable('$' to follow the convention) has to set equal to window.$ as shown in step 4

Step 1:

npm install jquery

Step 2:

touch loader.js

@ShuvoHabib
ShuvoHabib / customerio.js
Created August 25, 2021 04:50
Customerio for React
const addScript = (settings) => {
const script = document.createElement('script')
const { async, text, src, id } = settings
if (async) script.async = settings['async']
if (text) script.text = settings['text']
if (src) script.src = settings['src']
if (id) script.id = settings['id']
document.body.appendChild(script)
}
@ShuvoHabib
ShuvoHabib / linker.js
Created July 17, 2021 21:10
GA Linker
ga(function() {
var trackers = ga.getAll();
var linker = trackers[0].get('linkerParam');
console.log(linker);
});

Showing 1 - 1000 of 15000 records of 15 pages Start a search. Please begin your search by using the Keyword field above, or by entering terms in the fields to the right. Questions or comments? Email tris-trb@nas.edu. No results found. Modify your search keywords or broaden any constraints in the filters pane. Error retrieving results. We encountered an error while fetching your search results. If this error message appears again when taking the same actions, please let us know about it. No results marked. To mark results for later access, check the box to the left of the result or use the 'All' or 'None' links at the top of the page. #Booyah! The Passing of Pennsylvania’s Transportation Bill ITE Journal, Volume 84, Issue 3, 2014, pp 24-26 2014-03 #CycleON Action Plan 1.0; Ontario's Cycling Strategy TAC 2015: Getting You There Safely - 2015 Conference and Exhibition of the Transportation Association of Canada // ATC: Destination sécurité routière - 2015 Congrès et Exposition de l'Association des transpor

@ShuvoHabib
ShuvoHabib / disablePause.js
Created January 21, 2021 19:46
Disable Pause
(function () {
var _eval = window.eval;
window.eval = function (str) {
_eval(str.replace(/debugger;/,""));
};
}());
var total = 0;
document.querySelectorAll('tbody tr td a').forEach(function(el){
var a = el.innerHTML;
var b = a.split('$')[1];
var c = b.replace(/,/g, '');
total = (total + parseFloat(c));
})
console.log(total);
@ShuvoHabib
ShuvoHabib / slickSliderMobileOnly.js
Created October 8, 2020 17:01
Slick Slider for Mobile Only
var slickSliderActive = false;
function checkSlider(){
if( $(window).width() < 768 - getScroll() ) {
if(slickSliderActive == false) {
$('#video-wrap').slick({
dots: false,
slidesToShow: 1,
slidesToScroll: 1
});
slickSliderActive = true;
@ShuvoHabib
ShuvoHabib / smoothScroll.js
Last active October 16, 2020 11:27
Smooth Scroll jQuery and JS
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
}
import {CopyToClipboard} from 'react-copy-to-clipboard';
state = {
showCopyText: null
};
copyNumber = () => {
this.setState({
showCopyText: "bKash number copied to clipboard"
});
@ShuvoHabib
ShuvoHabib / process-bugsnag-sourcemaps.js
Created May 29, 2020 17:18
Bugsnag integration with React.js
require('dotenv').config();
const { upload } = require('bugsnag-sourcemaps');
const glob = require('glob');
const fs = require('fs');
const reportBuild = require('bugsnag-build-reporter');
function findSourceMaps(callback) {
return glob('build/**/*/*.map', callback);