Skip to content

Instantly share code, notes, and snippets.

View mutukrish's full-sized avatar
🎯
Focusing

Muthukrishnan K mutukrish

🎯
Focusing
View GitHub Profile
@mutukrish
mutukrish / Explain_Stats.md
Last active October 16, 2024 03:54
Explain Stats Index Recommendation MDB

How it work:

$match Stage: The system detects fields used in the $match stage and suggests creating indexes for equality matches and range queries ($gte, $lt, etc.).

$sort Stage:
For each field used in $sort, the system suggests creating an index to avoid costly in-memory sorting.

@mutukrish
mutukrish / Agg_Index_Recommendation.md
Last active October 16, 2024 05:11
Index recommendation using pure Aggregation pipeline stage

How It Works:

  • Aggregation Stages: The system looks through each stage of an aggregation pipeline ($match, $sort, $group, $lookup) and generates appropriate indexes.
  • Index Key Creation: The indexes are created based on the fields used in each stage
  • Logical and Comparison Operators: It handles $and, $or, $eq, $gt, and similar logical and comparison operators to determine which fields should be indexed.
  • Aliases Handling: The code applies any field aliases created by $project or $addFields stages and adjusts the index accordingly.
@mutukrish
mutukrish / github_setup.sh
Last active February 2, 2023 20:14
Ssh autogenerate
_github_check_login () {
if ssh [email protected] 2> /dev/null; then
echo "Should never happen, ssh to git always fails with 'does not provide shell access'"
exit 1
else
ssh_exit_status=$?
if [ $ssh_exit_status = 255 ]; then
return 1
else
return 0
@mutukrish
mutukrish / 01-stateless.js
Created August 18, 2020 02:35
React Component patterns
const Button = props =>
<button onClick={props.onClick}>
{props.text}
</button>
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Fix Cross Domain Ajax request CORS" />
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link href='http://fonts.googleapis.com/css?family=Roboto:400,500' rel='stylesheet' type='text/css'>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">

SCSS

Cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the awesome CSS extensions you've always wished you had:

  • [Nested selectors
<body>
<div id="sky"></div>
<div id="sun_yellow"></div>
<div id="sun_red"></div>
<div id="clouds">
<div class="cloud x1"></div>
<div class="cloud x2"></div>
<div class="cloud x3"></div>
<div class="cloud x4"></div>
<div class="cloud x5"></div>
<body>
<div id="sky"></div>
<div id="sun_yellow"></div>
<div id="sun_red"></div>
<div id="clouds">
<div class="cloud x1"></div>
<div class="cloud x2"></div>
<div class="cloud x3"></div>
<div class="cloud x4"></div>
<div class="cloud x5"></div>
<body>
<div class="wrapper">
<div class="base-s"></div>
<div class="base" class="base"></div>
<div class="base-h"></div>
<div class="base-g"></div>
<div class="hand-s"></div>
<div class="cup-s"></div>
<div class="hand"></div>
<div class="cup-b" class="base"></div>