-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from disberd/bondatble_collapsed
- Loading branch information
Showing
4 changed files
with
44 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This function is an internal helper that returns just the letters (without numbers and dashes) of the currently running cell id. Returns a random string of 10 letters in case the currently running cell id can not be parsed. Mostly used to produce consistent ids for javascript scripts in Pluto | ||
function cell_id_letters(limit = 10) | ||
fallback = String(rand('a':'z', 10)) | ||
isdefined(Main, :PlutoRunner) || return fallback | ||
isdefined(Main.PlutoRunner, :currently_running_cell_id) || return fallback | ||
ref = Main.PlutoRunner.currently_running_cell_id | ||
(ref isa Ref && isassigned(ref)) || return fallback | ||
uuid = ref[] | ||
# Return up to `limit` characters | ||
str = replace(string(uuid), r"[\d-]" => "") | ||
return first(str, limit) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters