Skip to content

Instantly share code, notes, and snippets.

View Nitinrajyadav's full-sized avatar
🖖

Nitin Raj Yadav Nitinrajyadav

🖖
View GitHub Profile
@Nitinrajyadav
Nitinrajyadav / logger.ts
Last active November 6, 2020 11:30
Simple TypeScript Logging Wrapper over console
class Logger {
private static __ENABLED__ == true; // use something like webpack-provider-plugin to inject __ENABLED__
private static doLog = (fun: string, ...args: any[]) => {
if (!Logger.__ENABLED__) { return; }
console[fun]?.bind(console)(...args);
}
@Nitinrajyadav
Nitinrajyadav / .git-commit-template.txt
Last active October 3, 2019 13:54 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Provide links to all related tasks
# Example: https://example.com/#/tasks/1234
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any other relevant issues, articles or other resources
@Nitinrajyadav
Nitinrajyadav / Socket.java
Created January 19, 2019 16:20 — forked from AliYusuf95/OnEventListener.java
Websocket implementation using OkHttp3 with {event->data} message format to make your life easier.
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.ProtocolException;
import java.util.HashMap;
@Nitinrajyadav
Nitinrajyadav / Laravel-Container.md
Created December 15, 2017 05:32
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container

@Nitinrajyadav
Nitinrajyadav / IoTmanager.ino
Created April 12, 2017 21:16 — forked from 4refr0nt/IoTmanager.ino
ESP8266 client for IoT Manager (Android app)
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
@Nitinrajyadav
Nitinrajyadav / introrx.md
Created April 1, 2017 11:47 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Nitinrajyadav
Nitinrajyadav / android.md
Created March 29, 2017 13:59 — forked from ahmedlhanafy/android.md
Android Cheat Sheet

Android Cheat Sheet

Developer tips

Ripple Effect

android:clickable="true"
android:background="?attr/selectableItemBackground"

or