eRESUME
Fullstack Developer Email: [email protected] Linkedin: https://www.linkedin.com/in/muhammadumerdev/ Stackoverflow: https://stackoverflow.com/users/1319799/muhammad-umer Github: https://github.com/techsin
eRESUME
Fullstack Developer Email: [email protected] Linkedin: https://www.linkedin.com/in/muhammadumerdev/ Stackoverflow: https://stackoverflow.com/users/1319799/muhammad-umer Github: https://github.com/techsin
function sortBooks() { | |
let books = [...document.querySelectorAll('ul#g-items li h3> a.a-link-normal')].map(el => findAncestor(el, 'g-item-sortable')); | |
let sorted = bubbleSort(books); | |
let frag = document.createDocumentFragment(); | |
sorted.forEach(x => frag.appendChild(x)); | |
let ul = document.querySelector("ul#g-items"); | |
ul.innerHTML = ''; | |
ul.append(frag); | |
alert('done'); | |
return frag |
function merc(lat, lon) { | |
let r_major = 6378137.000, | |
x = r_major * toRadians(lon), | |
scale = x/lon, | |
y = 180.0/Math.PI * Math.log(Math.tan(Math.PI/4.0 + lat * (Math.PI/180.0)/2.0)) * scale; | |
return (x, y) | |
} | |
function toRadians (angle) { | |
return angle * (Math.PI / 180); |
const crypto = require('crypto'); | |
function hash(msg){ | |
return crypto.createHash('sha256').update(msg).digest('hex'); | |
} | |
// '24d78aedae3a0747299d9c7b93f524221aa20c73274faab1ef75f584c453fcb0' | |
// what did i say? |
var arr = ["apple", ["apple","fix","apple"],["Apple", "apple"]]; | |
function recurCount([...arr]) { | |
const WORD = 'apple'; | |
if (arr.length === 0) { | |
return 0; | |
} else { | |
let tmp = arr.pop(); |
function isThere(arr, t) { | |
//Usually Mergesort n log(n) | |
arr.sort((a,b)=> a>b?true:false); | |
let i = 0, | |
j = arr.length-1, | |
x = arr[i], | |
y = arr[j]; | |
// O(n) |
socket.emit('message', "this is a test"); //sending to sender-client only | |
socket.broadcast.emit('message', "this is a test"); //sending to all clients except sender | |
socket.broadcast.to('game').emit('message', 'nice game'); //sending to all clients in 'game' room(channel) except sender | |
socket.to('game').emit('message', 'enjoy the game'); //sending to sender client, only if they are in 'game' room(channel) | |
socket.broadcast.to(socketid).emit('message', 'for your eyes only'); //sending to individual socketid | |
io.emit('message', "this is a test"); //sending to all clients, include sender | |
io.in('game').emit('message', 'cool game'); //sending to all clients in 'game' room(channel), include sender | |
io.of('myNamespace').emit('message', 'gg'); //sending to all clients in namespace 'myNamespace', include sender | |
socket.emit(); //send to all connected clients | |
socket.broadcast.emit(); //send to all connected clients except the one that sent the message |
/* | |
Question 1 -- sumOfTwo(a,b,v): You have two integer arrays, a and b, and an integer target value v. Determine whether there is a pair of numbers, where one number is taken from a and the other from b, that can be added together to get a sum of v. Return true if such a pair exists, otherwise return false. | |
Question 2 -- stringReformatting(string): The string s contains dashes that split it into groups of characters. You are given an integer k that represents the number of characters in groups that your output should have. Your goal is to return a new string that breaks s into groups with a length of k by placing dashes at the correct intervals. If necessary, the first group of characters can be shorter than k. It is guaranteed that there are no consecutive dashes in s. | |
For s = "2-4a0r7-4k" and k = 4, the output should be stringReformatting(s, k) = "24a0-r74k"; | |
The input string "2-4a0r7-4k" is split into three groups with lengths of 1, 5 and 2. Since k = 4, you need to split the string into two groups of |
var max = 20; | |
var i = 0; | |
var word; | |
while (i++ < max) { | |
if (i % 3 == 0) { | |
word = 'Fizz'; | |
if (i % 5 == 0) { | |
word += 'Buzz'; | |
} | |
} else if (i % 5 == 0) { |
.widget .header h3 { | |
padding:30px!important; | |
color: green!important; | |
background-color: black!important; | |
font-size:30px!important; | |
text-align: center!important; | |
} |