Skip to content

Instantly share code, notes, and snippets.

View aakashns's full-sized avatar
🎯
Focusing

Aakash N S aakashns

🎯
Focusing
View GitHub Profile
@aakashns
aakashns / fromStore.js
Created March 22, 2017 17:17
Basic version of fromStore.
const fromStore = (state, db) => {
db.ref('message').set(state.message);
}
@aakashns
aakashns / fromDb.js
Created March 22, 2017 16:31
First version of fromDb
const fromDb = (db, dispatch) => {
db.ref('/message').on('value', data => {
if (data.val()) {
dispatch({ type: 'SET_MESSAGE', payload: data.val() });
}
});
};
@aakashns
aakashns / store.js
Last active March 22, 2017 16:36
Redux store for Firebase + Redux blog post.
import { createStore } from 'redux';
const reducer = (state = {}, action) => {
switch(action.type) {
case 'SET_MESSAGE':
return {
...state,
message: action.payload
};
// Handle other actions here

Keybase proof

I hereby claim:

  • I am aakashns on github.
  • I am aakashns (https://keybase.io/aakashns) on keybase.
  • I have a public key ASDJcqfR2DuLZOMPqSuNdaAmzsCTUMZxkAmBOS-AeMfdvgo

To claim this, I am signing this object:

@aakashns
aakashns / PermissionHandler.java
Created November 27, 2016 17:31
Utility class to assist with requesting permissions at run time on Android.
import android.content.pm.PackageManager;
import android.os.Build;
/**
* {@link PermissionHandler} provides a simple API to request Android permissions
* at runtime. The class exposes one static method: {@link #request} which the
* requesting activity should call to request or check for permission. The requesting
* activity must implement {@link PermissionActivity}.
*/
public class PermissionHandler {
@aakashns
aakashns / JsonConverterFactory.java
Created November 7, 2016 06:38
Custom Converter Factory for Retrofit 2 ( https://square.github.io/retrofit/ ) to convert the ResponseBody to a JSONObject.
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import okhttp3.ResponseBody;
import retrofit2.Converter;
import retrofit2.Retrofit;
@aakashns
aakashns / 00_FirebaseAccountKit.java
Last active November 4, 2016 01:06
Helper class to connect Facebook's AccountKit with Firebase to create OTP (SMS) based login flow on Android
package in.swiftace.firekit;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import com.facebook.accountkit.AccountKitLoginResult;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthResult;
@aakashns
aakashns / App.jsx
Last active May 25, 2016 06:09
Starting App.js
import React, { Component } from 'react';
import {
View,
Text,
} from 'react-native';
export default class App extends Component {
render() {
return (
@aakashns
aakashns / commands
Last active May 24, 2016 15:41
Building an Audio Streaming Player in React Native
$ npm install react-native-cli@latest
$ react-native init ReactMusic

Keybase proof

I hereby claim:

  • I am aakashns on github.
  • I am aakashns (https://keybase.io/aakashns) on keybase.
  • I have a public key whose fingerprint is 3E0D D672 AA31 F260 B8EE A17B A8DD A142 719A 26A9

To claim this, I am signing this object: