Skip to content

Instantly share code, notes, and snippets.

@willurd
willurd / web-servers.md
Last active May 17, 2024 16:24
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@smileham
smileham / Export to Markdown.ajs
Last active April 25, 2024 14:06
Export an ArchiMate diagram to Markdown format. #jarchi
/*
* Export View to Markdown
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
*
* Markdown - https://www.markdownguide.org/
*
* Version 2: Updated to support Diagram Groups
* Version 2.1: Add check for Selected View
* Version 2.2: Change to regex, added date of export
@jbsarrodie
jbsarrodie / AddUnshownRelationship.ajs
Last active March 8, 2023 14:35
#jArchi script to add all possible relationships to a view
// Find DiagramComponents for a given element in a given view
var getDiagramComponents = function(v, e) {
return $(v).find("concept").filter(function(o) {
return o.concept.id == e.id;
});
}
// Checks if a view contains a visual connection from src and tgt visual objects
var contains = function(r, src, tgt) {
found = false;
@Phillipus
Phillipus / DeleteUnusedElements.ajs
Created August 30, 2018 10:59
#jArchi function to delete ArchiMate elements that are not references in any View in a model.
function deleteUnusedElements() {
$("element").each(function(element) {
if($(element).objectRefs().isEmpty()) {
element.delete();
}
});
}
@adgerrits
adgerrits / ShowMissingElementsInTwoViews.ajs
Last active April 10, 2021 19:16
#jArchi script to compare two views and show mutual missing Archimate elements
/*
* Comparison of two views to see which Archimate elements are missing
* 2018, Ad Gerrits
*/
console.clear();
function checkViews (v1, v2) {
var v2elements = [];
$(v2).find('element').each(function (e) {
v2elements.push(e.concept.id);
/*
* Change Concept Type
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
*
* Updated from original to prompt for types
*
* Version 1: First release
* Version 2: Error handling
*
@jbsarrodie
jbsarrodie / AddOrUpdateProperty.ajs
Created September 6, 2018 19:25
#jArchi script to add or update properties on a selection of objects
var propName = window.prompt("Which property do you want to add or update (leave empty to cancel)?", "");
if (propName) {
var propValue = window.prompt("Which value do you want to set for '"+propName+"' (leave empty to cancel)?", "");
if (propValue) {
$(selection).prop(propName, propValue);
}
}
@jbsarrodie
jbsarrodie / RemoveProperty.ajs
Created September 6, 2018 19:26
#jArchi script to delete a property on a selection of objects
var propName = window.prompt("Which property do you want to remove (leave empty to cancel)?", "");
if (propName) {
$(selection).removeProp(propName);
}
@smileham
smileham / Export to CSV.ajs
Last active April 24, 2024 16:44
Export to CSV #jarchi
/*
* Export To CSV
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
* Requires PapaParse - https://www.papaparse.com/
* Works with Import from CSV script - https://gist.github.com/smileham/1e57a5946235e780dee5a824f664aa3d
*
* Version 1: Export to CSV
* Version 1.1: Avoid duplicate concepts exported from diagram
* Version 1.2: Fix missing properties
@smileham
smileham / Import from CSV.ajs
Last active April 24, 2024 16:43
Import from CSV #jarchi
/*
* Import from CSV
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
* Requires PapaParse - https://www.papaparse.com/
* Works with Export to CSV Script - https://gist.github.com/smileham/15c445b17a92bd6f5dc1508e573bcd8a
*
* Version 1: Import from CSV
* Version 1.1: Force character encoding to use UTF-8
* Version 2: Support for Specialization and creates "CSVImport-timestamp" view