sci

https://github.com/babashka/SCI - also see #babashka and #nbb
borkdude 2021-05-27T09:26:59.055400Z

@jeroenvandijk

❤️ 2
2021-05-27T09:27:15.055700Z

awesome!

borkdude 2021-05-27T09:36:26.056Z

Pushed it now

2021-05-27T09:47:34.056200Z

I’m already using it 😅🚀

borkdude 2021-05-27T10:10:08.056400Z

There is now also scittle.core.eval_script_tags(), handy if you are editing remote scripts and want to reload them from the console

2021-05-27T10:11:35.056700Z

Yeah I saw it while experimenting. Nothing better than working in a live environment 😅

borkdude 2021-05-27T10:14:26.057Z

Awesome that you can now edit your existing bookmarklet :)

borkdude 2021-05-27T10:14:29.057200Z

released it

🎉 1
2021-05-27T10:14:30.057400Z

If we end up with many plugins maybe something like a require-plugins will be handy. For the bookmarklet case for instance you need to coordinate the loading of scripts and it’s all asynchronous. This is for when you want to go fancy with reagent in your bookmarklet

2021-05-27T10:14:41.057600Z

Yeah nice right, i’m having fun with it as well haha

borkdude 2021-05-27T10:15:27.057900Z

maybe it will be best if we left the moment of all evaluation to the user

borkdude 2021-05-27T10:15:44.058100Z

and also the moment of when the plugin is registered?

borkdude 2021-05-27T10:16:39.058300Z

oh you want to use reagent in your bookmarklet?

2021-05-27T10:16:52.058500Z

Maybe 🙂

borkdude 2021-05-27T10:17:05.058700Z

you can disable the auto-loading of the snippets right now using scittle.core.disable_auto_eval()

2021-05-27T10:17:38.059Z

I’ll come up with some use cases first and hack around. Maybe a nice pattern will emerge later

borkdude 2021-05-27T10:17:59.059200Z

sounds good. https://borkdude.github.io/scittle/disable_auto_eval.html

2021-05-27T10:18:04.059400Z

I also thought sharing bookmarklets via gists could be nice. E.g something like your https://borkdude.github.io/sci.web/?gist=jeroenvandijk/190c254c3ff5c25752d3f59d5d3e7f19

borkdude 2021-05-27T10:18:46.059600Z

yeah, I guess people could just publish an HTML page where you click on a button to get it as a bookmarklet right

borkdude 2021-05-27T10:19:06.059800Z

but yeah, loading from a gist...

borkdude 2021-05-27T10:19:17.060Z

feel free to implement it, it's your subproject :)

borkdude 2021-05-27T10:19:27.060200Z

you can also put your name on the page: Author: Jeroen van Dijk

👍 1
😅 1
2021-05-27T10:19:51.060500Z

haha yeah I’ll try to make something useful first. I just wanted to fix at least the obvious errors for now

2021-05-27T10:30:43.061800Z

Would it be possible to let the user upload their cljs code as a file with scittle?

2021-05-27T10:30:58.062300Z

It could make a cool intro to reagent xD

borkdude 2021-05-27T10:39:06.062700Z

@neo2551 I think you can implement that in scittle, if the browser lets you do that

2021-05-27T10:39:38.063300Z

I mean you can add a new tag at the end of the body

borkdude 2021-05-27T10:39:42.063500Z

scittle exposes scittle.core.eval_string() so you can call that after you load the file

2021-05-27T10:39:54.063800Z

Oki doky

borkdude 2021-05-27T10:42:44.063900Z

what exactly prevents apps from loading bookmarklets?

borkdude 2021-05-27T10:42:49.064100Z

when is it not allowed?

2021-05-27T11:58:11.064300Z

Some sites (rightfully so) set the Content Security Policy headers to be restricting this (https://content-security-policy.com/)

2021-05-27T11:59:08.064700Z

This limits the use cases a bit, but maybe a browser extension could be added that undoes this again if we want to use it on those sites

2021-05-27T12:00:44.064900Z

I was thinking of adding metadata to a bookmarklet that would check (in javascript) to see if the domain is whitelisted to give the user a better error. E.g. “This bookmarklet can only be used on the following domains …”

2021-05-27T12:54:56.065400Z

An extension like https://requestly.io/ could alter those headers to add http://borkdude.github.com to the whitelist for instance. Probably too much effort for most people, but maybe interesting for the power users

eval2020 2021-05-27T13:18:58.066700Z

The scittle bookmarklet-generator is good fun 🙂 Search the Slack-archives:

(when-some [q (js/prompt "Search the Clojurians Slack-archive:")]
  (set! (.. js/document -location -href) (str "<https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/search/>" q)))

👍 2
eval2020 2021-05-27T13:22:48.067500Z

Prefilling via a query-param would be cool: https://borkdude.github.io/scittle/bookmarklet.html?script=%28when-some,,,,

2021-05-27T14:03:39.067800Z

Sounds like a good idea! How would you generate the query string?

2021-05-27T14:03:59.068Z

Should it be part of the editor?

2021-05-27T14:04:33.068200Z

Like a “Share button” (copy to clipboard)?

eval2020 2021-05-27T14:22:38.068400Z

I was looking at using history.pushstate - it would update the script -param while editing.

eval2020 2021-05-27T14:24:31.068800Z

Will fiddle with it some more tonight

2021-05-27T14:28:56.069Z

Yeah that could work. Right now you can also drag an existing bookmark to the editor and the cljs code will be extracted

eval2020 2021-05-27T14:32:34.069200Z

ah nice. This preload-via-script-param would allow for a bookmark to be inspected/modified by others before bookmarking

2021-05-27T14:42:52.069400Z

Makes sense! Better not too trust arbitrary obfuscated scripts in urls 😅

eval2020 2021-05-27T15:11:50.069600Z

🙂 WCGW!

2021-05-27T16:42:15.069800Z

@eval2020 I’ve added some support for gists https://github.com/borkdude/scittle/pull/4

2021-05-27T16:48:07.070100Z

Your idea is probably easier to work with (no need to create gists, just copy link somewhere)

eval2020 2021-05-27T16:49:34.070300Z

nice one! Will build on top of that PR then.

borkdude 2021-05-27T17:33:20.070500Z

merged and released

eval2020 2021-05-27T20:27:47.070700Z

PR open https://github.com/borkdude/scittle/pull/5 I hope the wording in the UI for the newly introduced link is clear…

👏 1
borkdude 2021-05-27T20:38:24.071200Z

merged and releasing now

1
borkdude 2021-05-27T20:51:48.071600Z

@eval2020 what is the sharing button supposed to do?

borkdude 2021-05-27T20:51:54.071800Z

it refreshes the page for me

eval2020 2021-05-27T20:52:12.072Z

It’s meant as a permalink to the state of the editor

borkdude 2021-05-27T20:52:20.072200Z

ah

eval2020 2021-05-27T20:52:22.072400Z

So copy and share

borkdude 2021-05-27T20:52:54.072600Z

but when you click the link, it's not on your clipboard right?

eval2020 2021-05-27T20:53:23.072800Z

no indeed - that would’ve been the nicer way to do it

borkdude 2021-05-27T20:53:38.073Z

it's already a nice improvement btw :)

eval2020 2021-05-27T20:54:30.073200Z

I’m sure it can be improved with better layout/icon etc

eval2020 2021-05-27T20:54:59.073400Z

already it would allow for a paragraph on that page with sample bookmarklets 🙂