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 / App.js
Created May 13, 2017 16:39
React JS Navigation Tab (The ES6 Way)
import React, {Component} from 'react';
import './App.css';
class App extends Component {
state = {
isSelected: 'All',
};
handleClick = (lang) => {
this.setState({isSelected: lang});
};
@ShuvoHabib
ShuvoHabib / File.js
Created May 13, 2017 16:44
Vue 2 JS: File uploader with custom events
const File = {
name: 'File',
methods: {
openFileDialogue() {
const field = this.$refs.field;
const event = new MouseEvent('click', {
view: window,
bubbles: false,
cancelable: true
});
@ShuvoHabib
ShuvoHabib / gulp.js
Created May 13, 2017 16:46
GULP : One stop Solution for Small to Large PHP and HTML Projects
### For PHP Files:
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
gulp.task('sass', function () {
return gulp.src('app/scss/**/*.scss')
.pipe(sourcemaps.init())
@ShuvoHabib
ShuvoHabib / fullReactRedux.js
Last active May 13, 2017 16:50
React and Redux: An Example of Using Redux with React
// constants.js
export const SHOW_CREATE_PROFILE = 'SHOW_CREATE_PROFILE';
// actions.js:
import * as types from './constants';
export function showCreateProfile() {
return {
@ShuvoHabib
ShuvoHabib / babelify.js
Last active June 19, 2021 08:01
ES6 on the fly : Babelify your ES6 to ES5 for browser support
//Currently all browsers don’t support all the new ECMAScript 2015 features yet. You need to use a compiler (transpiler) to transform your ECMAScript 6 code to ECMAScript 5 compatible code.Babel has become the de-facto standard to compile ECMAScript 6 applications to a version of ECMAScript that can run in current browsers. Let dive into Babel, assuming you've npm pre-installed...
//First Navigate(cd) to the directory by command prompt you're going to work
//Type the following command below to create a package.json file:
//npm init
//The following command is to install the babel-cli and babel-core modules:
@ShuvoHabib
ShuvoHabib / promise.js
Created June 7, 2017 05:23
Promise base API Call
getGroupChatDetails() {
this.conversations[this.id].members.map(id => {
const promise = this.fetchProfile(id);
promise.then((result) => {
//this.profileDetails.push(result.payload.data.data.profile);
this.profileDetails = result.payload.data.data.profile;
}, (err) => {
console.log(err);
});
});
@ShuvoHabib
ShuvoHabib / bootstrapextention.css
Last active July 10, 2017 17:12
Bootstrap Clearfix Extension for rows
@media (min-width:1200px){
.auto-clear .col-lg-1:nth-child(12n+1){clear:left;}
.auto-clear .col-lg-2:nth-child(6n+1){clear:left;}
.auto-clear .col-lg-3:nth-child(4n+1){clear:left;}
.auto-clear .col-lg-4:nth-child(3n+1){clear:left;}
.auto-clear .col-lg-6:nth-child(odd){clear:left;}
}
@media (min-width:992px) and (max-width:1199px){
.auto-clear .col-md-1:nth-child(12n+1){clear:left;}
.auto-clear .col-md-2:nth-child(6n+1){clear:left;}
@ShuvoHabib
ShuvoHabib / subscribe.js
Last active August 6, 2017 05:21
MailGun Subscription
var mailgunURL;
mailgunURL = window.location.protocol + "//" + window.location.hostname + '/ajax/mailgun.php';
$('#mailgun').on('submit', function (e) {
$(this).attr("disabled", true);
var dataString = $(".newsletter-content form").serialize()
$.ajax({
type: 'POST',
url: "subscribeform.php",
data: dataString,
success: function () {
@ShuvoHabib
ShuvoHabib / contact.html
Created August 6, 2017 05:24
Mailgun Contact Form
<div class="contact-form">
<form id="contactform" name="contactform" method="post">
<div class="row">
<div class="col-sm-6">
<input name="name" class="form-control" type="text" placeholder="Name*"/>
</div>
<div class="col-sm-6">
<input name="email" class="form-control" type="email" placeholder="Email*"/>
</div>
<div class="clearfix"></div>
@ShuvoHabib
ShuvoHabib / media-query.css
Created December 7, 2017 10:50 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS