{{ message }}

Instantly share code, notes, and snippets.

One coffee every five minute.

Anam Ahmedtheanam

One coffee every five minute.
Created Jul 7, 2014
Keybase account proof
View keybase.md

Keybase proof

I hereby claim:

• I am theanam on github.
• I am theanam (https://keybase.io/theanam) on keybase.
• I have a public key whose fingerprint is 9F55 C1A3 C36F F2F0 A2B9 46B8 0514 642C B259 A081

To claim this, I am signing this object:

Last active Sep 29, 2015
Quick Sort algorithm in JavaScript (with a relatively bigger memory complexity, for demonstration purpose only)
View quicksort.js
 var unsorted = [53,12,22,87,74,67,23,45,77,1,8,44]; function quickSort(arr){ if(arr.length<2) return arr; var smaller = []; var larger = []; var pivot = arr[Math.floor(Math.random()*arr.length)]; for(i=0;i
Last active Sep 29, 2015
Sieve of Eratosthenes in JavaScript
View Sieve.js
 /* Sample Implementation of Sieve algorithm for 1-3000 not optimized yet */ var ar = []; var max = 3000; //loop should run only till the square root of the maximum var maxloop = Math.round(Math.sqrt(max)); for(a=0;a
Created Sep 29, 2015
Euclid's algorithm for finding GCD
View gcd.js
 function gcd(a,b){ if(a==0 || b==0){ return a; } else{ return gcd(b,a%b); } } //test console.log(gcd(10,45));
Created May 7, 2018
View dragdroptouch.js
 var DragDropTouch; (function (DragDropTouch_1) { 'use strict'; /** * Object used to hold the data that is being dragged during drag and drop operations. * * It may hold one or more data items of different types. For more information about * drag and drop operations and data transfer objects, see * HTML Drag and Drop API. *
Created Aug 28, 2018
Docker Compose for Strapi with Mongodb
View docker-compose.yml
 version : "3" services: strapi-mongo: image: mongo environment: - MONGO_INITDB_DATABASE=strapi volumes: - ./db:/data/db strapi-app:
Created Sep 29, 2018
LWHH JavaScript Course Number Project
View number.js
 let x = parseInt(process.argv[2]); let y = parseInt(process.argv[3]); console.log(x+y);
Created Apr 5, 2019
Stdout logs on Steroids
View logger.js
 const moment = require('moment'); const colors = { "green" :"\x1b[32m", "yellow":"\x1b[33m%s\x1b[0m", "red":"\x1b[31m", "cyan":"\x1b[36m", "blue":"\x1b[34m", "default":"" } module.exports = function (message,color="default"){
Last active Jul 17, 2019
A small JavaScipt function to resize image in frontend and return a new JPEG file
View resize_image_in_frontend.js
 /**** Creatd by Anam Ahmed (https://anam.co) Sample Use: document.querySelector("input[type=file]").addEventListener("change",function(e){ if(e.target.files.length){ _resample(e.target.files[0],1000,function(response){ console.log(response); // returns an object: {stats:,file:output file} }); } });
Created Sep 4, 2019
Regular Expression to match Bangladeshi Phone number
View regex.txt
 /^(?:\+88|88)?(01[3-9]\d{8})\$/
You can’t perform that action at this time.