Skip to content

Instantly share code, notes, and snippets.

Avatar

Vlad Spreys sprejjs

View GitHub Profile
@sprejjs
sprejjs / AndroidManifest.xml
Created Jul 26, 2020
Exposing the custom messaging service
View AndroidManifest.xml
<service android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
@sprejjs
sprejjs / MyFirebaseMessagingService.kt
Created Jul 26, 2020
Custom firebase messaging service
View MyFirebaseMessagingService.kt
package com.spreys.pushnotifications
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.media.RingtoneManager
import android.os.Build
import androidx.core.app.NotificationCompat
@sprejjs
sprejjs / MainActivity.kt
Created Jul 26, 2020
Fetch firebase token
View MainActivity.kt
FirebaseInstanceId.getInstance().instanceId
.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
return@OnCompleteListener
}
val token = task.result?.token
Toast.makeText(baseContext, token, Toast.LENGTH_SHORT).show()
})
@sprejjs
sprejjs / build.gradle
Created Jul 26, 2020
Firebase messaging library
View build.gradle
implementation 'com.google.firebase:firebase-messaging:20.2.3'
@sprejjs
sprejjs / build.gradle
Created Jul 26, 2020
Google messaging service plugin
View build.gradle
apply plugin: 'com.google.gms.google-services'
@sprejjs
sprejjs / build.gradle
Created Jul 26, 2020
Google messaging service
View build.gradle
classpath "com.google.gms:google-services:4.3.3"
View digram.js
<script src="d3.v4.min.js"></script>
<svg width="960" height="900"></svg>
<script>
d3.csv("categories.csv", function(error, data) {
if (error) throw error;
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height"),
View Data visualisation.py
# libraries
import numpy as np
import matplotlib as mpl
mpl.use('TkAgg')
import matplotlib.pyplot as plt
import pandas as pd
import codecs
import csv
# Fill up the data
@sprejjs
sprejjs / step12.java
Created Aug 11, 2017
Step 12. Attach new OnClickListener.
View step12.java
holder.parentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, DetailsActivity.class);
intent.putExtra(DetailsActivity.EXTRA_CONTACT, contact);
context.startActivity(intent);
}
});
@sprejjs
sprejjs / step11.java
Created Aug 11, 2017
Step 11. Attach LayoutManager.
View step11.java
recyclerView.setLayoutManager(new LinearLayoutManager(this));
You can’t perform that action at this time.