Skip to content

Instantly share code, notes, and snippets.

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

Bob James mobibob

🏠
Working from home
View GitHub Profile
@mobibob
mobibob / WebChromeClient (webview) onprogresschanged
Created March 24, 2011 18:36
This snippet was needed for viewing a long html
@Override
public void onProgressChanged(WebView view, int newProgress) {
Log.i(TAG, "onProgressChanged # " + newProgress);
if (newProgress >= PERCENT_100) {
if (lastTarget != null) {
webview.loadUrl(lastTarget);
lastTarget = null;
}
@mobibob
mobibob / dumpCursor
Created June 24, 2011 20:20
Android cursor dump
private void dumpCursor(Cursor myCursor) {
if (myCursor == null) {
Logs.w(TAG, "Null cursor");
} else {
try {
if (myCursor.moveToFirst()) {
String [] columns = myCursor.getColumnNames();
StringBuilder sbHeader = new StringBuilder();
for (String columnName : columns) {
sbHeader.append(columnName).append(", ");
@mobibob
mobibob / UrlExplore.m
Created May 23, 2012 23:57
Explore NSURL construction in XCode (iPad / iPhone)
@interface UrlDebug <NSObject> {
+(void) explodeNSUrl: (NSURL*) urlDebug;
}
@implementation UrlExplore {
+(void) explodeNSUrl: (NSURL*) urlDebug {
NSLog(@"\n\n%s: %@", __FUNCTION__, urlDebug);
@mobibob
mobibob / gist:241425c00329e76ea59e6944b1a90349
Created July 28, 2016 23:16
android dismiss keyboard helper
private void dismissKeyboardHelper() {
View view = this.getCurrentFocus();
if (view != null) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
@mobibob
mobibob / html
Last active November 8, 2019 23:58
Azure bot framework iframe startConversation
<html>
<head>
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<script src="webbotFramework.js"></script>
</head>
<body>
<div id="webchat" role="main"></div>
<script>
@mobibob
mobibob / awk
Last active November 26, 2019 16:34
report all integration services requests from form-controllers written in javascript
## Understand that this is the popular pattern. More patterns may exist and hide from this script.
$ find . -name 'frm*.js' -exec awk '$0 ~ /operationName/, /invokeOperation/ { print(FILENAME, $0) }' {} \;
## More in a Kony App to find all the navigation code.
find . -name 'frm*.js' -exec awk '$0 ~ /new.*kony\.mvc\.Navigation/, /;/ { print(FILENAME, $0) }' {} \; | grep -v -e "/jssrc/" | wc
## This was the "spy" script to see if I was on the right track for the navigation crawl.
@mobibob
mobibob / sh
Last active February 3, 2021 20:02
sh cmdline to explode the $path in lines
# explode the $PATH variable into separate lines (for easy review)
#
# nb. put user cmdline in /usr/local/bin/ like this ... (don't forget to chmod 777)
# sudo mv my-binary /usr/local/bin/
env | grep -i "path" | tr : '\n'
@mobibob
mobibob / sh
Created November 26, 2019 13:27
yes-no prompt response in bash
while true; do
read -p "Do you wish to install this program?" yn
case $yn in
[Yy]* ) make install; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
@mobibob
mobibob / awk_if_then.awk
Created December 11, 2019 18:27
awk pulls function for report by filename
find ./ -name '*.js*' -exec awk 'BEGIN {fnbefore=""} /onBreakpointChange:.*function/,/},/ { if(fnbefore != FILENAME) {fnbefore=FILENAME; print FILENAME, ": "; } print "\t", $0; }' {} \;
@mobibob
mobibob / js
Created January 11, 2020 23:42
kony drag onTouchMove
define(function() {
return {
testSettings: {
showDataFrame: false
},
constructor: function(baseConfig, layoutConfig, pspConfig) {
this.initGettersSetters();
this.view.isVisible = false;