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 / performanceProfile.js
Last active February 15, 2020 22:21
Using javascript Date obj and getTime fn to profile code segment
stateCfg: {
tmStart: null,
tmFinish: null,
},
profileStart: function() {
// TODO: This is a heavy API/network zone.
let tmStart = this.stateCfg.tmStart = Date.now();
// NOTE TO SELF -- the getMinutes and getSeconds did not work.
console.log(">>>># START: " + Date(tmStart).split(" ")[4]);
@mobibob
mobibob / uialert.swift
Created January 20, 2020 14:26
swift UIAlertController in-line
let alert = UIAlertController(title: "My Alert", message: "This is an alert.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "Default action"), style: .default, handler: { _ in
NSLog("The \"OK\" alert occured.")
}))
self.present(alert, animated: true, completion: nil)
@mobibob
mobibob / simpleClasses.swift
Created January 20, 2020 14:23
simple swift class with init
class University
{
var university: String
init(university: String) {
self.university = university
}
}
class Discipline : University{
var discipline: String
@mobibob
mobibob / html
Last active January 11, 2020 23:46
inline-http get-token for Azure webchat botframework
<!DOCTYPE html>
<html>
<head>
<link href="https://ux.ohio.gov/assets/fonts/MyFontsWebfontsKit.css" rel="stylesheet">
<!-- reference your copy Font Awesome here (from our CDN or by hosting yourself) --->
<!--
<link href="http://fontawesome.io/css/fontawesome.css" rel="stylesheet">
<link href="http://fontawesome.io/css/brands.css" rel="stylesheet">
@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;
@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 / 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 / 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 / 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 / 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>