$ ls contents
If this is your first time encountering us and are startled by the section title, our overview is a good place to start; or check out our recent blog post if you'd like a high level read. If you're here because you'd like to have the LSD trips you define be available to other developers, then continue on reading.
From the web workbench, you'll need to give the trip a name. To do so, click on the EDIT button above the code editor and enter a name you'd like to refer to the trip by, the only character not allowed is the forward slash "/".
Next, click on the MAKE PUBLIC button. A modal will pop up with the boilerplate needed for someone to build on top of the trip you defined which is just invoking an ACCORDING TO expression following the below syntax:
ACCORDING TO <handle>/<trip_name>
If your "handle" is displaying the email you used when logging in with Google, that's because your address is set as the default handle when your account gets created. To update your profile, go to your profile page and click on the Edit profile under the table showcasing your profile details to set a new handle in the following form.
Assuming the trip you're looking to build on top of has been made Public by the author, you need their handle and the name they gave the query. You include these details in an ACCORDING TO expression that follows the grammar shown above. For example, let's say I have a trip with the name hacker_news_queries and I know the author, crash_override wrote it with the following definition:
post <| a |
post_link <| a@href |
container <| span.titleline |
hn <| https://news.ycombinator.com |
FROM hn
|> GROUP BY container
|> SELECT post, post_link;
I want to use the CSS selectors crash_override labeled but get only fetch the titles from Hacker News instead of also getting the links. With an ACCORDING TO expression, I can import his trip and write the query for exactly what I want.
ACCORDING TO crash_override/hacker_news_queries
FROM hn
|> GROUP BY container
|> SELECT post;
Following everything above with regard to the ACCORDING TO syntax and defining trips that build on top of others, imagine we had a query like the following (which goes to Hacker News, clicks on the "front" link in the navbar at the top, and then extracts from the resulting HTML following those interactions):
-- crash_override/hn_with_function_and_click
post <| a |
post_link <| a@href |
container <| span.titleline |
hn <| https://news.ycombinator.com |
get_front_page_of_hacker_news <|> <|
FROM hn
|> CLICK ON a[href="front"]
|> SELECT post, post_link
|> GROUP BY container |
To import the defined variables plus function, add an ACCORDING TO expression as how you'd expect to:
ACCORDING TO crash_override/hn_with_function_and_click
get_front_page_of_hacker_news;
However, running the above SQL as-is won't work until you connect your SQL to the browser. After doing that and then subsequently evaluating the trip that imports from hn_with_function_and_click, you'll see your browser go through the necessary actions to handle the get_front_page_of_hacker_news function.