Skip to content

Instantly share code, notes, and snippets.

View Prosen-Ghosh's full-sized avatar
🎯
Focusing

Prosen Ghosh Prosen-Ghosh

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am Prosen-Ghosh on github.
  • I am prosen_ghosh (https://keybase.io/prosen_ghosh) on keybase.
  • I have a public key whose fingerprint is D939 1505 888B 3B07 6453 5A50 F77D 3138 9240 8D51

To claim this, I am signing this object:

@Prosen-Ghosh
Prosen-Ghosh / commd.sh
Last active September 15, 2017 17:28
Importing larger sql files into MySQL
You can import large file using this command line way 2:
mysql -h localhost -u root -p
give the password
mysql> use database name
mysql> source path/example.sql
You can import large file using this command line way 2:
mysql -u root -p dbName < path/example.sql
@Prosen-Ghosh
Prosen-Ghosh / method-chaining.js
Created August 29, 2017 12:24
Method Chaining
var calculator = function(){
return this;
}
calculator.prototype.set = function (number){
if(number === undefined)this.number = Math.floor(Math.random() * 1000);
else this.number = number;
return this;
}
calculator.prototype.add = function(number = 0){
@Prosen-Ghosh
Prosen-Ghosh / palindrome.js
Last active August 29, 2017 12:51
Check palindrome string using map
let str = "123211";
let map = Array.prototype.map;
let newStr = map.call(str,function(x){
return x;
}).reverse().join('');
if(str === newStr)console.log("Palindrome");
else console.log("Not Palindrome");
@Prosen-Ghosh
Prosen-Ghosh / camelCase.js
Created August 29, 2017 13:16
Convert Camel case to dash
String.prototype.camelToDash = function(){
return this[0].toLowerCase() + this.slice(1).replace(/[A-Z]/g,function(w){
return '-'+ w.toLowerCase();
});
}
@Prosen-Ghosh
Prosen-Ghosh / celsiusToFahrenheit.js
Created August 29, 2017 13:19
Convert Celsius to Fahrenheit Problem Solution Using JavaScript.
function convertToF(celsius) {
var fahrenheit = (celsius * 9/5)+32;
return fahrenheit;
}
convertToF(30);
@Prosen-Ghosh
Prosen-Ghosh / findAndRemoveExclamationAndAddLast.js
Created August 29, 2017 13:26
Remove all exclamation marks from sentence but ensure a exclamation mark at the end of string
function remove(s){
return s.split('!').join('')+'!';
}
@Prosen-Ghosh
Prosen-Ghosh / primeList.js
Created August 30, 2017 10:25
It will generate 6,64,579 prime number.
function prime(n){
let arr = new Array(n).fill(true);
arr[0] = arr[1] = false;
let range = Math.sqrt(n);
for(let i = 2; i <= n; i++){
if(arr[i] === true){
for(let j = i*2; j <= n; j+= i){
arr[j] = false;
}
}
@Prosen-Ghosh
Prosen-Ghosh / getdayName.js
Created September 7, 2017 18:22
Get Day Name In JavaScript
var getDayName = function(dateFormate){
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
date = new Date(dateFormate);
return days[date.getDay()];
}
getDayName("08/01/2017"); // MM/DD/YYYY
// "Tuesday"