Avatar

andreterron

Dev Tools • Quantified Self
Joined August 18, 2022
Likes
10
vladimyr avatar
newValURL_example
@vladimyr
Script
// ==> https://www.val.town/new?code64=aW1wb3J0IHsgYmFzZTY0IGFzIGI2NCB9IGZyb20gIm5wbTptdWx0aWZvcm1hdHMvYmFzZXMvYmFzZTY0IjsKCmV4cG9ydCBmdW5jdGlvbiBuZXdWYWxVUkwoY29kZTogc3RyaW5nLCBiYXNlNjQgPSB0cnVlKSB7CiAgY29uc3QgdXJsID0gbmV3IFVSTCgiaHR0cHM6Ly93d3cudmFsLnRvd24vbmV3Iik7CiAgaWYgKCFiYXNlNjQpIHsKICAgIHVybC5zZWFyY2hQYXJhbXMuc2V0KCJjb2RlIiwgY29kZSk7CiAgICByZXR1cm4gdXJsOwogIH0KICAvLyBAc2VlOiBodHRwczovL3d3dy52YWwudG93bi92L2Vhc3JuZy9wbGF5Z3JvdW5kP3Y9MzQzI0w3MDMtNzA0CiAgY29uc3QgYnl0ZXMgPSBuZXcgVGV4dEVuY29kZXIoKS5lbmNvZGUoY29kZSk7CiAgdXJsLnNlYXJjaFBhcmFtcy5zZXQoImNvZGU2NCIsIGI2NC5iYXNlRW5jb2RlKGJ5dGVzKSk7CiAgcmV0dXJuIHVybDsKfQ
nbbaier avatar
valToGH
@nbbaier
Script
valToGH A utility function for programmatically updating a GitHub repository with code retrieved from a Val. NOTE : This function currently does not change the contents of a file if it is already present. I will however be adding that functionality. Usage import { valToGH } from 'https://esm.town/v/nbbaier/valToGH'; const repo = "yourGitHubUser/yourRepo"; const val = "valUser/valName"; // or vals = ["valUser/valName1","valUser/valName2", ...] const ghToken = Deno.env.get("yourGitHubToken"); const result = await valToGH(repo, val, ghToken); console.log(result); Parameters repo : The GitHub repository in the format {user}/{repo} . val : A single repository in the format {user}/{val} . ghToken : Your GitHub token for authentication (must have write permission to the target repo) Options branch : Optional target branch. Default is main . prefix : Optional directory path prefix for each file. message : Optional commit message. Default is the current date and time in the format yyyy-MM-dd T HH:mm:ss UTC . ts : Optional flag to use a .ts extension for the committed file instead of the default .tsx .
stevekrouse avatar
json_viewer
@stevekrouse
Script
Inspector to browser json data in HTTP vals Example: https://val.town/v/stevekrouse/weatherDescription Thanks @mmcgrana (https://markmcgranaghan.com/) for the idea!
dupontgu avatar
washer_3d
@dupontgu
HTTP
Generates a 3D model of a flat washer, in .stl format. Pass in number parameters for washer "thickness" ("t"), "hole_radius" ("hr"), and "outer_radius" ("r"): https://dupontgu-washer_3d.web.val.run/?t=2&hr=8&r=10
stevekrouse avatar
TodoApp
@stevekrouse
HTTP
SSR React Mini & SQLite Todo App This Todo App is server rendered and client-hydrated React. This architecture is a lightweight alternative to NextJS, RemixJS, or other React metaframeworks with no compile or build step. The data is saved server-side in Val Town SQLite . SSR React Mini Framework This "framework" is currently 44 lines of code, so it's obviously not a true replacement for NextJS or Remix. The trick is client-side importing the React component that you're server rendering . Val Town is uniquely suited for this trick because it both runs your code server-side and exposes vals as modules importable by the browser. The tricky part is making sure that server-only code doesn't run on the client and vice-versa. For example, because this val colocates the server-side loader and action with the React component we have to be careful to do all server-only imports (ie sqlite) dynamically inside the loader and action , so they only run server-side.
stevekrouse avatar
emailGPT3
@stevekrouse
Script
Email with GPT-3 Send an email to stevekrouse.emailGPT3@valtown.email, it will forward it to gpt3, and email you back the response.
Next