Skip to content

Instantly share code, notes, and snippets.

Harit Himanshu hhimanshu

  • Santa Clara, CA
View GitHub Profile
@hhimanshu
hhimanshu / intellij_community_uninstall_mac.sh
Created Jul 24, 2018
Remove the IntelliJ completely from your mac
View intellij_community_uninstall_mac.sh
# First remove the app from `/Applications`
rm -rf ~/Library/Caches/IdeaIC201*; rm -rf ~/Library/Preferences/IdeaIC201*;rm -rf ~/.ivy2/cache
View firebaseApi.js
import * as admin from "firebase-admin";
export const getFirebaseApp = (credentialsJsonFile, appName) => {
let fbAdmin = admin.initializeApp({
credential: admin.credential.cert(credentialsJsonFile)
}, appName);
return fbAdmin.firestore();
};
@hhimanshu
hhimanshu / copyFileFromJar.scala
Last active May 31, 2018
Copy File inside Jar to External Location
View copyFileFromJar.scala
import java.io.File
import java.net.URL
// Note: This has dependency on apache commons-io
import org.apache.commons.io.FileUtils
object LoadFile extends App {
override def main(args: Array[String]): Unit = {
val fileName = "myfileJarFile.json"
val path: URL = getClass.getClassLoader.getResource("v410.all/" + fileName)
@hhimanshu
hhimanshu / how to read unfamiliar codebase.md
Last active Jan 22, 2017
how to read unfamiliar codebase
View how to read unfamiliar codebase.md

Overview

These are in no particular order. I found them by researching what methods other developers use to understand codebases that they have not seen before.

Recommendations

  • If the codebase has tests, read the tests
  • Try to write tests for the part of codebase you are trying to understand. This helps in understanding the behavior and serve as documentation
  • Get overview of project. See the overall picture. How many modules it has? What are the name of the modules? Pick one module and do deep dive into it.
  • Writing documentation for source code. This is a good practice to understand the codebase. I tend to prefer writing tests over documentation since the source code and tests are truth, documentation decays over time, generally.
@hhimanshu
hhimanshu / Trie.java
Created Jan 29, 2016
R-Way Tries (Leetcode)
View Trie.java
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
*/
@hhimanshu
hhimanshu / .Functional Programming in Scala Exercises
Last active Sep 9, 2018
Functional Programming in Scala Exercises
View .Functional Programming in Scala Exercises
All exercises are attempted on https://coderpad.io
@hhimanshu
hhimanshu / InsertJson.scala
Created Aug 28, 2015
Insert JSON document into ElasticSearch using Elastic4s
View InsertJson.scala
// Dependency: elastic4s
import java.util.Calendar
import com.sksamuel.elastic4s.ElasticDsl._
import com.sksamuel.elastic4s.source.StringDocumentSource
import com.sksamuel.elastic4s.{ElasticClient, ElasticsearchClientUri}
import org.elasticsearch.action.index.IndexResponse
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
@hhimanshu
hhimanshu / Chapter01.json
Created Aug 25, 2015
ElasticSearch: The definitive guide
View Chapter01.json
GET _search
{
"query": {
"match_all": {}
}
}
PUT /megacorp/employee/1
{
"first_name": "John",
View README.md
@hhimanshu
hhimanshu / Scala.For.The.Impatient.md
Last active Oct 19, 2018
Scala for the Impatient Exercises
View Scala.For.The.Impatient.md

This gist will contain all the exercises from the book

You can’t perform that action at this time.