Skip to content

Instantly share code, notes, and snippets.

@amitkumar
amitkumar / resume.json
Last active January 7, 2024 20:36
JSON Resume
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"meta": {
"version": "v1.0.0",
"canonical": "https://github.com/jsonresume/resume-schema/blob/v1.0.0/schema.json"
},
"basics": {
"name": "Amit Kumar",
"label": "Software Engineering Leader",
"image": "",
@amitkumar
amitkumar / handlebars-helpers-templates.html
Last active March 24, 2022 16:32
Useful Handlebars Helpers. Get specific array item, if equals filter
<script id="if_equals_example" type="text/x-handlebars-template">
{{#if_equals objectType 'message'}}
<div class="message">
Message
</div>
{{else}}
{{/if_equals}}
</script>
@amitkumar
amitkumar / cloudSettings
Last active November 24, 2021 16:47
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-11-24T16:47:18.411Z","extensionVersion":"v3.4.3"}
@amitkumar
amitkumar / getObjectId.js
Last active December 12, 2019 12:00
A utility method to get the ObjectID from a variety of input types. In working with a Mongoose REST API, I encounter mongoose subdocuments that may or may not be populated, may or may not be hydrated Mongoose models, and _id's that may be coming from the front-end that are just strings. This method allows you to pass in those 3 possibilities and…
const ObjectID = require('mongodb').ObjectID;
/**
* Returns the ObjectId of the object, taking into account
* whether the object is a populated Model, an ObjectId, or
* a string representation of an ObjectID.
*
* @param {MongooseModel|Object|String} input
* @return ObjectId
*/
/**
* Disable or enable focus on all focusable elements. Useful for proper keyboard navigation
* of slide-based interfaces where certain slides are hidden/shown based on user interaction.
* Assumes jQuery.
*
* @param {jQuery object} $el - jQuery object whose children will be toggled
* @param {bool} enable
* /
var toggleFocusableElements = function($el, enable){
if (enable){
@amitkumar
amitkumar / join-with-commas.js
Created September 4, 2014 22:12
Join an array of words with commas and a final "and"
function joinWithCommas (array){
var result = '';
$.each(array, function(index, label){
if (index === 0){
} else if (index < (array.length - 1)){
result += ', ';
} else {
result += ' and ';
}
result += label;
@amitkumar
amitkumar / Sublime Text Configuration.md
Last active August 29, 2015 13:56
A useful setup/config for Sublime Text 3 for coders.
@amitkumar
amitkumar / Useful things for developers for OS X.md
Last active August 29, 2015 13:56
Useful apps/utilities/settings for coders for OS X
@amitkumar
amitkumar / handlebars-precompiler.js
Last active August 29, 2015 13:56
Precompile all handlebars templates on page load
// Assumes jQuery
var handlebarsTemplates = {};
$(function(){
// Compile all templates
$('script[type="text/x-handlebars-template"]').each(function(index, element) {
var $element = $(element),