Skip to content

Instantly share code, notes, and snippets.

View abhishekhugetech's full-sized avatar
🎯
Focusing

Abhishek Kumar Singh abhishekhugetech

🎯
Focusing
View GitHub Profile
@abhishekhugetech
abhishekhugetech / dynamo_db_query_all_items_count.js
Created May 31, 2020 16:57
Uses the query function of DynamoDB DocumentClient class to count all the items from a table. Use index with only keys projected for best performance.
const AWS = require("aws-sdk");
const documentClient = new AWS.DynamoDB.DocumentClient();
let itemCount = 0;
var params = {
TableName: 'table_name',
IndexName: 'part-range-index',
KeyConditionExpression: '#t = :hkey',
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/mainappbar"
android:layout_width="match_parent"
android:layout_height="@dimen/_150dp"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
@abhishekhugetech
abhishekhugetech / Notification.java
Created January 9, 2019 21:18
Code for Creating a notification channel in Android.
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "name_of_channel";
String description = "description for notification channel";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel( "channel_id_here" , name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
@abhishekhugetech
abhishekhugetech / NoteKeeperProviderContract
Created January 8, 2019 19:07
Defines the Contract Class for the Content Provider
package com.jwhh.jim.notekeeper;
import android.net.Uri;
import android.provider.BaseColumns;
/**
* Created by Jim.
*/
public final class NoteKeeperProviderContract {
private NoteKeeperProviderContract(){}
@abhishekhugetech
abhishekhugetech / NoteKeepDatabaseContract.java
Created January 6, 2019 07:30
Database contract class for Revision
package com.jwhh.jim.notekeeper;
public final class NoteKeepDatabaseContract {
private NoteKeepDatabaseContract(){}
public static final class CourseInfoEntry{
public static final String TABLE_NAME = "course_info";
public static final String COLUMN_COURSE_ID = "course_id";
public static final String COLUMN_COURSE_TITLE = "course_title";
@abhishekhugetech
abhishekhugetech / MainActivity.java
Created January 2, 2019 06:31
Click Event handing using OnClickListener Listener Interface
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private ConstraintLayout constraintLayout;
private Button button1;
private Button button2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);