Skip to content

Instantly share code, notes, and snippets.

View tejpratap46's full-sized avatar
🏠
Working from home

Tej Pratap Singh tejpratap46

🏠
Working from home
View GitHub Profile
@tejpratap46
tejpratap46 / proxy-microservice.js
Created June 15, 2017 13:22
A simple proxy microservice
module.exports = (url = 'world', context, callback) => {
var http = require("https");
var req = http.get(url, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
@tejpratap46
tejpratap46 / ImageUtil.java
Created July 5, 2017 07:15
Generate Bitmap from view in android
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.Log;
import android.view.View;
import java.util.ArrayList;
public class ImageUtil {
/**
@tejpratap46
tejpratap46 / PDFUtil.java
Last active February 23, 2022 06:18
Android Generate PDF from view, Use https://github.com/tejpratap46/PDFCreatorAndroid for simple use
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfRenderer;
import android.os.AsyncTask;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@tejpratap46
tejpratap46 / CustomLinearLayoutManager.java
Last active July 26, 2017 11:57
Make RecyclerView smooth scroll in a NestedScrollView
public class CustomLinearLayoutManager extends LinearLayoutManager {
public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
// It will always pass false to RecyclerView when calling "canScrollVertically()" method.
@Override
public boolean canScrollVertically() {
return false;
@tejpratap46
tejpratap46 / speechrec.md
Last active July 8, 2018 13:07
things TODO for speech recognition app.
@tejpratap46
tejpratap46 / styles.xml
Created January 1, 2021 18:45
Transparent Bottom Sheet
<resources>
<style name="TransparentBottomSheetDialogTheme" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorSecondary">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="bottomSheetStyle">@style/TransparentBottomSheetStyle</item>
</style>
<style name="TransparentBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">