Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Akash Nidhi P S SkyTreasure

🎯
Focusing
View GitHub Profile
View AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackagename">
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
View CustomPackage.java
package com.yourpackagename;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
View HeadlessService.java
package com.yourpackagename;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.jstasks.HeadlessJsTaskConfig;
View BackgroundScanModule.java
package com.yourpackagename;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.Location;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
View BackgroundScanService.java
package com.yourpackagename;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
@SkyTreasure
SkyTreasure / movies.json
Last active Jun 21, 2019
Movie API Sample
View movies.json
{
"comingsoon": [
{
"id": "65",
"title": "Zama",
"year": "2017",
"genres": [
"Drama"
],
"ratings": [
@SkyTreasure
SkyTreasure / FirebaseOnlineOfflinePresence.kt
Created Nov 6, 2017
This function sets the online status to true under user node. And sets to false when user exits the app or gets disconnected with the internet.
View FirebaseOnlineOfflinePresence.kt
/**
* This function sets the online status to true under user node. And sets to false when
* user exits the app.
*/
fun setOnlinePresence() {
FirebaseDatabase.getInstance().reference.child(".info/connected")
var onlineRef = FirebaseDatabase.getInstance().reference.child(".info/connected")
var currentUserRef = FirebaseDatabase.getInstance().reference.child("/users/" + sCurrentUser?.uid + "/online");
var lastSeenRef = FirebaseDatabase.getInstance().reference.child("/users/" + sCurrentUser?.uid + "/last_seen_online");
@SkyTreasure
SkyTreasure / load_test_data.sh
Created Jul 13, 2017 — forked from clintongormley/load_test_data.sh
Run these commands in your shell to setup the test data for Chapter 5
View load_test_data.sh
curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d '
{
"email" : "john@smith.com",
"name" : "John Smith",
"username" : "@john"
}
'
curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d '
{
View summary_tool.py
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):