Skip to content

Instantly share code, notes, and snippets.

View xkeshav's full-sized avatar
🟪

Keshav Mohta xkeshav

🟪
View GitHub Profile
@xkeshav
xkeshav / css-christmas-tree-click-to-restart.markdown
Created December 25, 2022 04:03
CSS Christmas Tree 🎄 [Click to restart]
@xkeshav
xkeshav / Ubuntu to mac OS.md
Last active April 22, 2022 06:12 — forked from zymr-keshav/Ubuntu to macOS.md
useful tweaks and tip while switching from ubuntu to macOS x

Ubuntu to Mac OS.

following are my finding while switching from ubuntu to macOS, first I describe the issue and what is the alternative in the mac OS before moving forward, let's know the version name by their number denoated as OS X

version number version name
10.10 "Yosemite"
10.11 "EI Captian"
10.12 "Sierra"
10.13 "High Sierra"
@xkeshav
xkeshav / deep-merge-object.js
Created September 29, 2021 16:54
interview questioin: how to deep merge 2 objects
const user1 = {name: 'alpha', age: 23, address: {street: 'alpha road', city: 'Pune'}, gender: {sex: 'male'}};
const user2 = {name: 'beta', age: 25, address: {street: 'beta road', state: 'Maharashtra'}};
const deepMerge = (source, target) => {
for(const [key, val] of Object.entries(source)) {
if(val !== null && typeof val === 'object') {
if(target[key] === undefined) {
target[key] = {...val}
}
deepMerge(val, target[key]);
@xkeshav
xkeshav / jumble.js
Last active September 28, 2021 14:56
Interview question: find numeral letter from a random string
const input = 'torzeonthowoereezero';
// idea here is, first check that every letter of numeral exist in the given string,
// if it exist then remove the numeral letter from given string and search for next numeral and so on
const numeral = {
'zero' : 0,
'one': 1,
@xkeshav
xkeshav / vs-code.settings
Last active September 21, 2021 16:59
VS code recommeneded user settings
{
"editor.snippetSuggestions": "top",
"editor.wordWrap": "on",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"[html]": {
"editor.formatOnSave": true,
"editor.quickSuggestions": {
"other": true,
"comments": false,
@xkeshav
xkeshav / curl.sh
Created July 7, 2017 15:41
run curl from a file with parameter as post data and variable such as current date, random number
#!/bin/bash
# call as `sh curl.sh <uuid> <hostname>`
# exmaple sh curl.sh 595e341fd7391071d21ce1b5 20.20.1.73
header="Content-Type: application/json"
enc=$(shuf -i 0-1000 -n 1)
dec=$(shuf -i 10-600 -n 1)
now=$(date +%s%3N)
post_data=$(cat <<EOF
{
"ip_address": "$2",
@xkeshav
xkeshav / popular.js
Created May 29, 2013 07:16
usage of jsonp first time
@xkeshav
xkeshav / gist:3367635
Created August 16, 2012 07:15 — forked from remy/gist:360113
setInterval run once, then keep running
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
@xkeshav
xkeshav / calss.debug.php
Created May 23, 2011 07:35
how to debug in php files
/** This function is used to debug variables during page execution
* @param $what , the variable which need to debug,can be array or single variable
* @param $more , to know the method and line number where that variable is used
* @param $die , set TRUE if want to stop the page
* how to use : debug::watch($postarray,1,1);
* @author keshav mohta
* @date Aug 12, 2010
*/
class debug()
{
@xkeshav
xkeshav / find.html
Created December 20, 2014 10:39
Search panel with help of latest CSS and all possibility taken care
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Iterator : Unit Case</title>
<!-- <link rel="stylesheet" href="fix.css"> -->
<style type="text/css">
body {
font-style: sans-serif;