Skip to content

Instantly share code, notes, and snippets.

View Tobibur's full-sized avatar
🎯
Focusing

Tobibur Rahman Tobibur

🎯
Focusing
View GitHub Profile
@Tobibur
Tobibur / AndroidManifest.xml
Last active September 11, 2023 04:06
Hilt Extension to test Fragment with @ AndroidEntryPoint
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="same.package.name">
<application>
<activity
android:name=".HiltTestActivity"
android:exported="false" />
</application>
@Tobibur
Tobibur / Solution.java
Created July 28, 2020 18:32
Maximum number of consecutive 1's in a binary number. https://www.hackerrank.com/challenges/30-binary-numbers/problem
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
@Tobibur
Tobibur / main.cs
Last active September 10, 2019 16:47
Difference between static & instance members
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine ("Difference between static & instance members");
Student student1 = new Student();
//student1.name = "Tobi"; //Cannot do this because its static
//It assigns the value to the whole class Student
Student.name = "Tobi";
@Tobibur
Tobibur / NotificationBarTransparent.kt
Created July 18, 2019 12:09
Making Android Notification Bar transparent
// Making notification bar transparent
if (Build.VERSION.SDK_INT >= 21) {
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
} else {
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
}
@Tobibur
Tobibur / scraper.py
Last active July 3, 2019 23:32
A python program that tracks Amazon product prices
import requests
from bs4 import BeautifulSoup
import time
URL = 'https://www.amazon.in/Boat-Rockerz-400-Bluetooth-Headphones/dp/B01J82IYLW/ref=gbps_img_s-5_9f8e_7e166db3?smid=A14CZOWI0VEHLG&pf_rd_p=b4500f5f-e496-4b18-ab75-623b14149f8e&pf_rd_s=slot-5&pf_rd_t=701&pf_rd_i=gb_main&pf_rd_m=A1VBAL9TL5WCBF&pf_rd_r=R6BV8CKA61WS2QHE114P'
headers = {
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
@Tobibur
Tobibur / SimpleJson.java
Created April 15, 2019 17:37
Parsing dynamic json values using iterator
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
public class SampleJson {
public static void main(String[] args) {
String jsonValue = "{\"status\":\"success\",\"response\":{\"data\":" +
@Tobibur
Tobibur / SharedPreferenceExample.java
Created January 30, 2019 10:17
Shared preference example from stackOverflow for quick access. Link: https://stackoverflow.com/a/23024962/8596924
// Setting values in Preference:
// MY_PREFS_NAME - a static String variable like:
// public static final String MY_PREFS_NAME = "MyPrefsFile";
SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putString("name", "Elena");
editor.putInt("idName", 12);
editor.apply();
//Retrieve data from preference:
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
@Tobibur
Tobibur / hosting-on-github.md
Created January 21, 2019 05:55 — forked from TylerFisher/hosting-on-github.md
Basic steps for hosting on Github

Steps for Hosting a Website on GitHub

  1. Create a GitHub account on github.com.
  2. Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
  3. (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
  4. Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
  5. Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level directory.
  6. Back in the GitHub application, you should see your files in the left column. Make sure they are all checked. If so, enter a mess
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#F00" />
<size android:width="10dp"/>
<padding android:bottom="0dp" android:left="0dp" android:right="0dp" android:top="0dp"/>
<corners android:topLeftRadius="5dp" android:bottomLeftRadius="5dp"
android:topRightRadius="0.1dp" android:bottomRightRadius="0.1dp"/>
</shape>
@Tobibur
Tobibur / MainActivity.java
Created August 10, 2018 10:44
Adding subtitle in exoplayer [Working]
package com.example.tobibur.videodemo;
import android.net.Uri;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.SimpleExoPlayer;