This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
$match: { | |
status: "paid", | |
} | |
}, | |
{ | |
$lookup: { | |
from: "orders", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
$match: { | |
status: {$ne: "cancelled"}, | |
createdAt: {$gt: ISODate('2024-03-31')} | |
} | |
}, | |
{ | |
$group: { | |
_id: { day: { $dayOfMonth: "$createdAt"}, year: { $year: "$createdAt" } }, | |
totalAmount: {$sum: "$revisedOrderTotal"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://rawgit.com/mauriciosantos/Buckets-JS/master/dist/buckets.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://rawgit.com/mauriciosantos/Buckets-JS/master/dist/buckets.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://practice.geeksforgeeks.org/problems/longest-valid-parentheses/0 | |
var seq = [1,0,1,0,1,1] | |
var counts = []; | |
var stack = []; | |
for(var i=seq.length-1;i>=0;i--){ | |
var val = seq[i]; | |
if(val){ | |
stack.push(val); | |
} | |
if(!val){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://practice.geeksforgeeks.org/problems/word-break-part-2/0 | |
var candidates = []; | |
var dict = ["snake", "snakes", "and", "sand", "ladder"]; | |
var input = "snakesandladder"; | |
for(var i=0;i<input.length;i++){ | |
debugger; | |
var chAtI = input.charAt(i); | |
if(candidates.length){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Solution to problem here - http://practice.geeksforgeeks.org/problems/max-absolute-difference/0 | |
var findCombination = function(arr){ | |
debugger; | |
var comb = []; | |
if(arr.length>1){ | |
comb.push(arr); | |
comb = comb.concat(findCombination(arr.slice(1,arr.length))); | |
comb = comb.concat(findCombination(arr.slice(0,arr.length-1))); | |
return comb; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Solution to problem here - http://practice.geeksforgeeks.org/problems/max-absolute-difference/0 | |
var findCombination = function(arr){ | |
debugger; | |
var comb = []; | |
if(arr.length>1){ | |
comb.push(arr); | |
comb = comb.concat(findCombination(arr.slice(1,arr.length))); | |
comb = comb.concat(findCombination(arr.slice(0,arr.length-1))); | |
return comb; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You have L, a list containing some digits (0 to 9). Write a function answer(L) which finds the largest number that can be made from some or all of these digits and is divisible by 3. If it is not possible to make such a number, return 0 as the answer. L will contain anywhere from 1 to 9 digits. The same digit may appear multiple times in the list, but each element in the list may only be used once. | |
var a = [3,1,4,1,5,9]; | |
var max = 0; | |
var pattern = function(arr){ | |
if(arr.length==1){ | |
return arr; | |
} | |
var patterns = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var customClickTouchStartEventList = "touchstart.customClick MSPointerDown.customClick pointerdown.customClick"; | |
var customClickTouchEndEventList = "touchend.customClick MSPointerUp.customClick pointerup.customClick"; | |
var customClickActiveGrpAttr = "data-activegrp"; | |
var customClickActiveAttr = "data-active"; | |
var customClickTimeoutAttr = "data-timeout"; | |
/** | |
* Custom click plugin that solves two issues | |
* 1. Remove the 300ms delay present for click event in touch devices. | |
* 2. Provide indicators on every click. |
NewerOlder