Skip to content

Instantly share code, notes, and snippets.

package edu.liu.locationexample;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import java.lang.reflect.Method;
/**
* Reference & Credits: http://mobiarch.wordpress.com/2012/07/17/testing-with-mock-location-data-in-android/
/*
USAGE:
DatabaseHelper databaseHelper = new DatabaseHelper(getActivity());
SQLiteDatabase sqLiteDatabase;
try {
databaseHelper.createEmptyDataBase();
sqLiteDatabase = databaseHelper.openDataBase();
@kiichi
kiichi / MyActivity.java
Last active December 20, 2015 10:49
ArcGIS API 2 for Android Drawing Polygon Example
package edu.liu.MyArcGISTemplate;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import com.esri.android.map.GraphicsLayer;
import com.esri.android.map.MapView;
@kiichi
kiichi / DbfInputStream2.java
Last active August 13, 2019 12:33
ShapeFile in Android Demo using OpenMap Library. Reading .shp and .dbf files after extracting the zip file into the external storage area. Learn Android Programming in our Online Course http://liu.edu/gis/
package edu.liu.shapefileexample;
// Note:
// This is my modified version for educational purpose by Kiichi Takeuchi. I removed swing dependency and changed class name.
//
// **********************************************************************
//
// <copyright>
//
@kiichi
kiichi / 0_reuse_code.js
Created August 23, 2014 02:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kiichi
kiichi / Countdown Clock
Created September 8, 2014 15:04
Set targetDate and calculate countdown until specific date in JavaScript
<html>
<body style="background-color:gray">
<div class="col-md-6 col-md-offset-3">
<p class="lead ultra-bold" style="color: #fff; text-align: center; margin-top: 17px; font-size: 36px;">
<span id="ct-days"></span><span style="color: #b5e2e4;">DAYS</span>
<span id="ct-hours"></span><span style="color: #b5e2e4;">HOURS</span>
<span id="ct-mins"></span><span style="color: #b5e2e4;">MINS</span>
</p>
</div>
<script>
@kiichi
kiichi / JavaScript Benchmark Function
Created December 26, 2014 18:44
JavaScript Benchmark Function
//--------------------------------------------------------------------------------------------------
// show benchmark result of function
// e.g. benchMe(heavyFunc,null,5)
function benchMe(myFunc, myArgs, cnt){
if (!cnt || cnt <= 0){
cnt = 1;
}
var startTime = (new Date()).getTime();
for (var i=0; i<cnt; i++){
myFunc(myArgs);
@kiichi
kiichi / post-commit
Last active November 30, 2020 14:49
post-commit svn hook for slack
#this is svn hook script - post-commit by Kiichi
#[Instructions]
#In slack, create incoming webhook integration, and grab the url
#cd /var/svnrepos/hooks
#cp post-commit.tpl post-commit
#chmod +x post-commit
REPOS="$1"
REV="$2"
SVNTMP="/var/log/svn-post.txt"
@kiichi
kiichi / unittest.sh
Last active June 11, 2018 09:39
Postman and Newman Integration with Slack
#This is script to run postman unittest from CLI
#Send the results to Slack
#by Kiichi
#[Instructions]
#In slack, create incoming webhook integration, and grab the url
#Create a complete postman unittest and environment then export it to a directory
#Make sure install node and newman.
#Save this script and give a permission, such as chmode +x unittest.sh
TMP="postman.out"
@kiichi
kiichi / unittest.js
Created January 15, 2015 23:20
Node Program to run Postman Script via Newman and Slack Integration
// Install These packages
//sudo npm install -g newman
//sudo npm install -g node-slack
// For mac set either $NODE_PATH or use the function below
module.paths.push('/usr/local/lib/node_modules');
var fs = require('fs');
var newman = require('newman');
var Slack = require('node-slack');
var slack = new Slack('mydomain','mytoken'); // setup Incomin Web Hooks and token is at the end of the url