Skip to content

Instantly share code, notes, and snippets.

View waliahimanshu's full-sized avatar

Himanshu Walia waliahimanshu

View GitHub Profile
@waliahimanshu
waliahimanshu / gist:b383bff6978a848f526f9bf233d477c8
Last active May 29, 2016 18:12
powershell script to install some dependencies WIP
########################################################
# Install packages
######################################################
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
$InstallDir=$env:ProgramW6432
$pathValue=$env:Path
$IsChocoEnvPathPresent = Test-Path $env:ChocolateyInstall
$IsVboxExtensionPackPresent=$InstallDir + "\Oracle\VirtualBox\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack"
@waliahimanshu
waliahimanshu / SetupRabbit
Created June 20, 2016 11:41
Setup rabbit on docker locally
#start rabbitmq image
# start rabbitmq-managemnt plugin
#docker stop some-rabbit
#docker rm some-rabbit
docker run -d -e RABBITMQ_NODENAME=my-rabbit --name some-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
sudo docker exec -it <container-name> /bin/bash
@waliahimanshu
waliahimanshu / RxJava8Example.java
Last active July 5, 2016 04:54
RxJava Functions and high order functions (RxJava8)
package com.company;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
public class Main {
public static void main(String[] args) {
//Reactive manifesto 1) event driven 2) scalable 3) reselient 4) responsive
@waliahimanshu
waliahimanshu / RxSyncAsync.java
Created July 18, 2016 17:46
RxJava Fetching Observables In Parallel (without Parallel operator)
import rx.Observable;
import rx.Subscriber;
import rx.schedulers.Schedulers;
//Reference example by benjchristensen
public class ParallelExecution {
public static void main(String[] args) {
System.out.println("------------ mergingAsync");
mergingAsync();
System.out.println("------------ mergingSync");
@waliahimanshu
waliahimanshu / The Technical Interview Cheat Sheet.md
Created January 22, 2017 19:17 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@waliahimanshu
waliahimanshu / Git Cheat Sheet
Last active April 6, 2018 10:49
My Git Cheat sheet (the stuff I keep looking on the web)
rename local / remote branch
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
your Git username for every repository on your computer
git config --global user.name "XXX"
/gradlew :f:module_name:lint/detek
internal const val ARG_ID_KEY = "ALARM_ID_KEY"
internal const val ARG_REQUEST_CODE_KEY = "ALARM_REQUEST_CODE_KEY"
internal const val ARG_ALARM_TYPE = "ARG_ALARM_TYPE"
/**
* @param appContext injected via DI
*/
class AlarmWrapperImp(private val appContext: Context) : AlarmWrapper {
private var alarmManager: AlarmManager? = null
interface AlarmWrapper {
fun setAlarm(alarmType: AlarmType, requestCode: String, id: String)
fun cancelAlarm(alarmType: AlarmType, requestCode: String, id: String)
}
enum class AlarmType {
TYPE1,
TYPE2,
UNKNOWN
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="64dp">
<ImageView
android:id="@+id/imageView2"