Skip to content

Instantly share code, notes, and snippets.

View emmkong's full-sized avatar

Emmanuel Kong emmkong

View GitHub Profile
@emmkong
emmkong / flattenData.js
Created August 25, 2019 12:24 — forked from smnh/flattenData.js
Function for flattening data before indexing it to Elasticsearch (http://smnh.me/indexing-and-searching-arbitrary-json-data-using-elasticsearch)
const _ = require('lodash');
module.exports = {
flattenData
};
/**
* This function flattens objects by converting them into a flat array of objects having four fields:
* - "key": the path of the field in the original object
* - "type": the type of the field value
@emmkong
emmkong / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@emmkong
emmkong / Get Relative Path in Unit Test
Last active November 28, 2023 08:04
Get full path from relative path in unit testing
private string GetFolderPath()
{
var currentAssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace(@"file:\", string.Empty);
var relativePath = Path.Combine(currentAssemblyPath, @"..\folder");
return Path.GetFullPath(relativePath);
}