Skip to content

Instantly share code, notes, and snippets.

View paulobunga's full-sized avatar
🏠
Available for work

Paul Obunga paulobunga

🏠
Available for work
View GitHub Profile
@paulobunga
paulobunga / RecyclerItemClickListener.java
Created July 17, 2019 09:27 — forked from chetangani/RecyclerItemClickListener.java
Recycler View implementing OnItemTouchListener
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
public interface OnItemClickListener {
@paulobunga
paulobunga / DeviceInformation.java
Created July 13, 2019 06:18 — forked from hendrawd/DeviceInformation.java
Helper class for getting Device Information
package your.app.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
@paulobunga
paulobunga / ImageInputHelper.java
Created July 4, 2019 01:43 — forked from eluleci/ImageInputHelper.java
Android: Helper for Android for selecting image from gallery, taking a photo with camera and cropping image.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.util.Log;
import java.io.File;
import java.io.IOException;
@paulobunga
paulobunga / LocationFragment.java
Created June 28, 2019 14:32 — forked from louisbl/LocationFragment.java
Fragment for Location Manager
package;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
@paulobunga
paulobunga / proxy.js
Created September 9, 2018 12:28 — forked from cmawhorter/proxy.js
Node script to forward all http requests to another server and return the response with an access-control-allow-origin header. Follows redirects.
// Simple proxy/forwarding server for when you don't want to have to add CORS during development.
// Usage: node proxy.js
// Open browser and navigate to http://localhost:9100/[url]
// Example: http://localhost:9100/http://www.google.com
// This is *NOT* for anything outside local development. It has zero error handling among other glaring problems.
// This started as code I grabbed from this SO question: http://stackoverflow.com/a/13472952/670023
@paulobunga
paulobunga / flash-app.js
Created September 6, 2018 13:58 — forked from brianmacarthur/flash-app.js
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@paulobunga
paulobunga / error_pages
Created September 2, 2018 21:30 — forked from ansemjo/error_pages
beautiful html5 error pages for nginx; applied globally for each server block
# this belongs inside a 'server {}' block
# I propose you put this in a file somewhere, e.g. /etc/nginx/error_pages
# and then include it with an 'include error_pages;' directive
#
# see it in larger context here:
# https://git.semjonov.de/server/nginx-conf/tree/b63de50001b15fbb33680de14fad05230f2b8fd2
#
# design is taken from html5-boilerplate:
# https://github.com/h5bp/html5-boilerplate/blob/master/src/404.html