Skip to content

Instantly share code, notes, and snippets.

View jokamjohn's full-sized avatar
🏠
Working from home

John Kagga jokamjohn

🏠
Working from home
View GitHub Profile
function generateFirebaseToken(lineMid) {
var firebaseUid = 'line:' + lineMid;
var additionalClaims = {
provider: 'LINE'
};
return firebase.auth().createCustomToken(firebaseUid);
}
@jokamjohn
jokamjohn / WaitForInitialValue.java
Created December 30, 2016 16:23 — forked from puf/WaitForInitialValue.java
Waiting for an initial value
public class Main {
static ValueEventListener mListener;
public static void main(String[] args) throws Exception {
Firebase ref = new Firebase("https://<your-app>.firebaseio.com/");
mListener = ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.exists()) {
System.out.println("The value is now "+snapshot.getValue());
@jokamjohn
jokamjohn / index.php
Created December 30, 2016 17:32 — forked from drizzentic/index.php
Sample USSD Application
<!-- MIT License
Copyright (c) 2016 Derrick Rono
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jokamjohn
jokamjohn / snippet.java
Created January 12, 2017 14:40 — forked from xaf-cv/snippet.java
Click&Hold detection through View.OnTouchListener()
View.OnTouchListener detectClickAndHoldListener = new View.OnTouchListener() {
private Timer timer = new Timer();
private long LONG_PRESS_TIMEOUT = 1337; // TODO: your timeout here
private boolean wasLong = false;
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.d(getClass().getName(), "touch event: " + event.toString());
@jokamjohn
jokamjohn / gist:0c1c86c4728f9f529651ba6c029c5797
Created January 12, 2017 15:28 — forked from samkirton/gist:0242ba81d7ca00b475b9
Fixed a bug where images added to the MediaStore are not inserted at the front of the gallery
package com.memtrip;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.graphics.Bitmap;
@jokamjohn
jokamjohn / edits.ino
Created March 15, 2017 10:23
Arduino Ftp
char *tStr = strtok(outBuf,"(");
tStr = strtok(NULL,"(");
if(tStr == NULL)
{
Serial.println("No parenthesis");
}
unsigned int hiPort,loPort;
@jokamjohn
jokamjohn / .eslintrc.json
Created September 23, 2017 02:56
React eslint config file
{
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
]
}
@jokamjohn
jokamjohn / Android Privacy Policy Template
Created November 12, 2017 08:59 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@jokamjohn
jokamjohn / bootstrap-nav-profile-pic.css
Created November 19, 2017 17:54 — forked from matthewhartstonge/bootstrap-nav-profile-pic.css
Bootstrap Navbar Profile CSS with HTML Example
/* Bootstrap Navbar Profile Picture CSS
*
* The CSS for profile pictures in the navbar has always annoyed me,
* so here's my fix that appears to have the least hoops.
*
* Production use:
* >Add a div with the specified class.
* >Using JS, change the profile picture CSS URL as needed.
*
* HTML example:
@jokamjohn
jokamjohn / react-store-testing.js
Created December 5, 2017 07:14
Simulating the redux store when testing
const store = {
subscribe: () => {},
dispatch: () => {},
getState: () => ({ ... whatever state you need to pass in ... })
}
const options = {
context: { store },
childContextTypes: { store: React.PropTypes.object.isRequired }
}