Skip to content

Instantly share code, notes, and snippets.

View ashutoshpw's full-sized avatar
:octocat:
Helping people to convert their Ideas into Reality

Ashutosh Kumar ashutoshpw

:octocat:
Helping people to convert their Ideas into Reality
View GitHub Profile
@ashutoshpw
ashutoshpw / my.js
Created December 13, 2015 19:02
First Gist
alert("hello world");
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@ashutoshpw
ashutoshpw / make.sh
Created July 23, 2017 20:55 — forked from artzub/make.sh
Install JetBrains Hub + YouTrack + UpSource + Nginx
#!/bin/bash
apt-get install mc htop git unzip wget curl -y
echo
echo "====================================================="
echo " WELCOME"
echo "====================================================="
echo
echo "Hub"
sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
// Needed in AndroidManifest:
<!-- Permission for using NFC hardware -->
<uses-permission android:name="android.permission.NFC"/>
<!-- Forcing device to have NFC hardware -->
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<!-- Registering app for receiving NFC's TAG_DISCOVERED intent -->
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
@ashutoshpw
ashutoshpw / DBHelper.java
Created May 6, 2018 13:40
Android DBHelper Example
public class DBHelper extends SQLiteOpenHelper{
// Database Information
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "sensor_data";
// Table and Column Names
public static final String TABLE_ACC = "acc";
private static final String CURRENT_TIMESTAMP = "CURRENT_TIMESTAMP";
private static final String KEY_ID = "id";
<service android:name=".myService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
@ashutoshpw
ashutoshpw / MyScheduleReciever.java
Created May 7, 2018 06:25
Android Broadcast receiver
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// assumes WordService is a registered service
// Your Action Here
@ashutoshpw
ashutoshpw / MainActivity.java
Created May 7, 2018 06:29
Android Shared Preference
public class MainActivity extends AppCompatActivity
SharedPreferences sharedpreference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);