Skip to content

Instantly share code, notes, and snippets.

View Nitin-Daddikar's full-sized avatar

Nitin Daddikar Nitin-Daddikar

View GitHub Profile
@Nitin-Daddikar
Nitin-Daddikar / excel.js
Created June 21, 2020 08:00
NPER, RATE, FV & PMT Excel functions in JavaScript
// The NPER function is a financial function that returns the number of periods for loan or investment
// rate - The interest rate per period.
// payment - The payment made each period.
// present - The present value, or total value of all payments now.
// future - [optional] The future value, or a cash balance you want after the last payment is made. Defaults to 0.
// type - [optional] When payments are due. 0 = end of period. 1 = beginning of period. Default is 0.
NPER(rate, payment, present, future, type) {
// Initialize type
type = (typeof type === 'undefined') ? 0 : type;
@Nitin-Daddikar
Nitin-Daddikar / tree.js
Created June 21, 2020 07:47
Building tree using parent and child flat JSON structure
var flatJSON = [
{
name : "A",
parent : "root"
},
{
name : "B",
parent : "root"
},
{
@Nitin-Daddikar
Nitin-Daddikar / style.css
Created May 5, 2019 09:35
vmax support in IE
.content{
/*supports modern browsers but not IE*/
width: 10vmax;
/*calculate vmax for IE */
height: calc(10 * (1vw + 1vh - 1vmin));
}
@Nitin-Daddikar
Nitin-Daddikar / style.css
Created June 21, 2018 04:22
Approaches to centering Div vertically and horizontally.
/*Approach 1 - transform translateX/translateY:*/
.centerDiv {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
/*Approach 2 - Flexbox method:*/
html, body, .centerDiv {
@Nitin-Daddikar
Nitin-Daddikar / index.html
Last active August 15, 2017 14:27
Nitin Daddikar - Different CSS for Different Browsers // source https://jsbin.com/viyiyim
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Different CSS for Different Browsers">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Nitin - Diff CSS for Diff Browser</title>
<style id="jsbin-css">
/* Default */
body{background: orange;}