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 / jQueryPlugin.js
Created September 24, 2018 22:21
jQuery Plugin
$.fn.greenify = function() {
this.css( "color", "green" );
};
$( "a" ).greenify(); // Makes all the links green.
@ShuvoHabib
ShuvoHabib / ajaxSendDatabyPOST.js
Created September 13, 2018 12:25
Ajax Send Data by Post
$.ajax({
type: "POST",
url: "https://www.test.co.uk/testquote/PersonalDetailsRequest",
data: {
EmailAddress: email,
EnquiryPageName: "",
EnquirySource: "",
EnquiryType: "",
FirstName: firstName,
LastName: lastName,
@ShuvoHabib
ShuvoHabib / addIPAudienceAdobeTarget.js
Created September 12, 2018 11:11
Add IP Audience Adobe Target
// add this to Profile Script
var strIp= user.header('x-cluster-client-ip');
var res = /^(119.148.14.249)$/.test(strIp);
if (res){
return 'Valid IP';
}else{
return 'Invalid IP' ;
}
@ShuvoHabib
ShuvoHabib / mutualExclusionOptimizelyClassic.js
Created September 12, 2018 10:26
Mutual Exclusion Optimizely Classic
/* CUSTOM JS TARGETING OF MUTUALLY EXCLUSIVE EXPERIMENTS
*
* Traffic allocation weighting is confined to the context of each
* individual experiment. In other words, each experiment has an
* equal chance of bucketing the visitor, regardless of if the
* chosen experiment has a large exclusion percentage due to
* traffic allocation.
*/
expArray = [34380472429,34393076390];
@ShuvoHabib
ShuvoHabib / ClosureFactoryFunctionCallApply.js
Created September 9, 2018 22:02
JS Basics (Closure, Factory Function, Call/Apply)
// Closure
function makeFunc(){
var name = "shuvo";
function takeData(){
console.log("My Name is " + name);
}
return takeData;
}
@ShuvoHabib
ShuvoHabib / Window Resize JS
Created August 30, 2018 11:52
Window Resize JS
function screenClass() {
if($(window).innerWidth() > 767) {
}
}
screenClass();
$(window).bind('resize',function(){
screenClass();
});
@ShuvoHabib
ShuvoHabib / scrollPercentageCustomGoal.js
Created August 27, 2018 07:14
Scroll Percentage CustomGoal 50% and 75%
(function () {
var isIntervals = setInterval(function () {
// GLOBAL VARIABLES
var jQuery = window.jQuery; // JQUERY
window.optimizely = window.optimizely || []; // OPTIMIZELY
if (jQuery !== undefined && window.optimizely !== undefined) {
var scrollFifty = true;
@ShuvoHabib
ShuvoHabib / masonarycolumn.html
Created June 28, 2018 10:40
Bootstrap Masonary column Like Pinterest
<style>
.row.make-columns {
-moz-column-width: 19em;
-webkit-column-width: 19em;
-moz-column-gap: 1em;
-webkit-column-gap:1em;
}
.row.make-columns > div {
display: inline-block;
@ShuvoHabib
ShuvoHabib / threeColumn.html
Created June 27, 2018 12:05
Three Column Layout
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
/* Create three equal columns that floats next to each other */
@ShuvoHabib
ShuvoHabib / checkbox.js
Created June 22, 2018 11:31
Check Box onclick value change
$("#squaredTwo").click(function(){
if(jQuery(this).val() === "unchecked") {
$(this).attr('value', 'checked');
console.log(jQuery("#squaredTwo").val());
} else {
$(this).attr('value', 'unchecked');
console.log(jQuery("#squaredTwo").val());
}
});