Skip to content

Instantly share code, notes, and snippets.

View mlcollard's full-sized avatar

Michael L. Collard mlcollard

View GitHub Profile
if (a < b)
a = b;
int position(int key, int elemArray[]) {
int bottom = 0;
int top = elemArray.length - 1;
while (bottom <= top) {
int midpoint = (top + bottom) / 2;
// found it
if (key == elemArray[midpoint])
void drawing(const std::string& command) {
if (objectname == "drawCircle")
drawCircle()
else if (objectname == "drawRectangle")
drawRectangle()
}
class Club {
public:
// ...
private:
std::list<Person*> members;
};
@mlcollard
mlcollard / calls_direct.xsl
Last active October 1, 2018 18:23
Static Analysis with srcML and XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.srcML.org/srcML/src"
xmlns:src="http://www.srcML.org/srcML/src"
version="1.0">
<!--
calls_direct.xsl
Direct calls from every function in CSV format
func sendChat() {
// convert the string message into Data
guard let msg = self.messageField.text?.data(using: .utf8) else {
print("Error: ", #line)
return
}
// send the converted message
try? self.session.send(msg, toPeers: self.session.connectedPeers, with: .unreliable)
@mlcollard
mlcollard / TVMLJsonBinding.js
Last active July 31, 2018 22:06
iOS: TVML: Json binding
var baseURL = "http://localhost:9001/"
function getDocument(url) {
var templateXHR = new XMLHttpRequest();
templateXHR.responseType = "document";
templateXHR.addEventListener("load", function() { pushDoc(templateXHR.responseXML);}, false);
templateXHR.open("GET", baseURL + url, true);
templateXHR.send();
}
@mlcollard
mlcollard / TVMLJson.js
Created April 30, 2018 14:38
iOS: TVML: Load data from Json file and display image
var baseURL = "http://localhost:9001/"
function getDocument(url) {
var templateXHR = new XMLHttpRequest();
templateXHR.responseType = "document";
templateXHR.addEventListener("load", function() { pushDoc(templateXHR.responseXML);}, false);
templateXHR.open("GET", baseURL + url, true);
templateXHR.send();
}
@mlcollard
mlcollard / NextPage.xml
Created April 30, 2018 14:08
iOS: TVML: Navigating between pages
<document>
<alertTemplate>
<description>This page has been pushed onto the navigation stack.</description>
</alertTemplate>
</document>
@mlcollard
mlcollard / TVMLLoading.js
Created April 30, 2018 14:00
iOS: TVML: Loading page with loaded local document
var baseURL = "http://localhost:9001/"
function getDocument(url) {
var templateXHR = new XMLHttpRequest();
templateXHR.responseType = "document";
templateXHR.addEventListener("load", function() {pushDoc(templateXHR.responseXML);}, false);
templateXHR.open("GET", url, true);
templateXHR.send();
}