Skip to content

Instantly share code, notes, and snippets.

View olivergeorge's full-sized avatar

Oliver George olivergeorge

  • Tasmania, Australia
  • 02:46 (UTC +10:00)
View GitHub Profile
@ncochard
ncochard / babel-webpack.md
Last active April 2, 2025 18:22
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@smileham
smileham / Export to Markdown.ajs
Last active February 25, 2025 21:51
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 September 20, 2024 04:11
#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;
@cdbkr
cdbkr / react-testing-library-clojurescript.cljs
Last active August 13, 2024 18:27
React-testing-library and Re-frame clojurescript app
(ns demo.core-test
(:require [cljs.test :refer [deftest
testing
is
use-fixtures]]
[clojure.string :refer [lower-case]]
[demo.components :refer [title-component
counter-component]]
[reagent.core :as r]
["react-testing-library" :as rtl]))
@felpasl
felpasl / ExportAllToMarkdown.ajs
Created June 11, 2019 15:21
#jArchi Create markdown to all Views from file based on smileham/Export to Markdown.ajs
/*
* Export All Views to Markdown
*
* Based on smileham/Export to Markdown.ajs - https://gist.github.com/smileham/578bbbb88dc0ed5a1403f3b98711ec25
* (c) 2018 Steven Mileham
*
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
*
* Markdown - https://www.markdownguide.org/
@rich-biker
rich-biker / documentation.ajs
Last active March 29, 2025 06:55
Generate Markdown documentation from a driving view in Archi using jArchi scripting.
/*
Sourced: https://gist.github.com/rich-biker/9a3c86c5a576ce0d8639856f3ee81651
Script: Documentation Generation
Purpose: To generate output based on a driving view
Author: Richard Heward - Tame Blue Lion Ltd
This generates a markdown file with the embedded images and text based upon a driving view in Archi of groups that trigger each other and embedded views.
See my blog for a more detailed explaination. https://www.tamebluelion.co.uk/blog/archi-documentation
@jfdeclercq
jfdeclercq / ExportImage.ajs
Last active September 20, 2024 04:11
Export View as image (PNG) with date and diagram name in filename. #jarchi
//Export View as image (PNG) with date and diagram name in filename.
// Get the first view in the model
//var view = $("view").first();
var view = selection.filter("archimate-diagram-model").first();
// Get the Base64 bytes of the view in PNG format. Can use "PNG", "BMP", "JPG" or "GIF"
// Options are scale (1 - 4) and margin (pixel value)
var bytes = $.model.renderViewAsBase64(view, "JPG", {scale: 1, margin: 20});
var date = new Date();
@jbsarrodie
jbsarrodie / Delete unused elements and relationships.ajs
Created March 2, 2020 15:33
#jArchi scripts to delete any element (or relationship) not used in at least one view
// Delete unused elements and relationships
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script will delete any element or relationship not used in at least one view
//
// (c) 2020 Jean-Baptiste Sarrodie
var response = window.confirm("This script will delete any element or relationship not used in at least one view. Continue?");
@jbsarrodie
jbsarrodie / Merge multiple concepts (and delete others).ajs
Last active September 20, 2024 04:13
#jArchi script to merge multiple concepts (and delete others)
// Merge multiple concepts (and delete others)
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script merges multiple concepts (and delete others)
//
// Version 1.1 (2020/01/20) Add an option to keep only the content of the "target" concept
// Version 1.0 (2019/11/12) First version published
//
// Known limitation: works only on elements, not relationships
@jbsarrodie
jbsarrodie / Sync Model from CSV.ajs
Last active December 14, 2024 07:09
#jArchi scripts to sync (some) model concepts from one or more CSV files
// Sync Model from CSV.ajs
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script allows easy integration of data coming from other systems through CSV files.
// Each CSV file is described through a configuration object that you can later load and sync.
// Most of the mapping informations (Id, Name, Documentation, Properties...) can be expressed through
// the name of a column from the CSV file or through a function (which allows more advanced computation).
//
// Dataset used as example comes from https://datahub.io/core/country-codes