Skip to content

Instantly share code, notes, and snippets.

Avatar

VIKAS KOHLI imvikaskohli

  • Pune, India
View GitHub Profile
@imvikaskohli
imvikaskohli / difference.js
Created Aug 13, 2020 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
View difference.js
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
View gist:2967d7886b500746787a9cb81abba4d0
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@imvikaskohli
imvikaskohli / simple-nodejs-iv-encrypt-decrypt.js
Created Apr 17, 2017 — forked from yoavniran/simple-nodejs-iv-encrypt-decrypt.js
nodejs crypto - simple encrypt & decrypt using IV (Initialization Vector)
View simple-nodejs-iv-encrypt-decrypt.js
"use strict";
var crypto = require("crypto");
var EncryptionHelper = (function () {
function getKeyAndIV(key, callback) {
crypto.pseudoRandomBytes(16, function (err, ivBuffer) {
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ;
@imvikaskohli
imvikaskohli / gist:963e7424e12af40c5d5ce0576d14fb3f
Created Feb 2, 2017 — forked from simonbingham/gist:3858121
JavaScript: Sorting and filtering data with AngularJS
View gist:963e7424e12af40c5d5ce0576d14fb3f
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AngularJS Sorting &amp; Filtering Example</title>
<style type="text/css">
body{ font:12px arial, sans-serif; line-height:1.6em; margin:0 auto; max-width:960px; }
@imvikaskohli
imvikaskohli / Common-Currency.json
Created Jan 30, 2017 — forked from Fluidbyte/Common-Currency.json
Common Currency Codes in JSON
View Common-Currency.json
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},