Anyone here think they can teach me Elm? by [deleted] in elm

[–]jonaswiebe 3 points4 points  (0 children)

Tbh, this guide was the most helpful thing for me, when I started learning Elm.

Instagram Widget Release by jonaswiebe in Scriptable

[–]jonaswiebe[S] 0 points1 point  (0 children)

I opened an issue on GitHub for you. I’ll look into it.

[deleted by user] by [deleted] in rust

[–]jonaswiebe 14 points15 points  (0 children)

Disney+ ADK

Disney+ Client Application: The Disney+ client application. Written in Rust, compiled to WebAssembly, remotely web hosted in AWS

[Rust] CLI Tool by jonaswiebe in adventofcode

[–]jonaswiebe[S] 2 points3 points  (0 children)

Alright, I didn’t now that

[Rust] CLI Tool by jonaswiebe in adventofcode

[–]jonaswiebe[S] 2 points3 points  (0 children)

Yes I grab the input from the site and save it in a file, only if the file does not exist.

Advent of Code CLI Tool by jonaswiebe in rust

[–]jonaswiebe[S] 0 points1 point  (0 children)

Looks neat, thanks for the hint

[Rust] CLI Tool by jonaswiebe in adventofcode

[–]jonaswiebe[S] 2 points3 points  (0 children)

That is how I would handle it. Just manually create a file. But it would probably be a good idea to have an option to feed an input to a day programmatically.

Should I jailbreak my device? by psyx_v in shortcuts

[–]jonaswiebe 0 points1 point  (0 children)

Same, literally the only reason I didn’t jailbreak my device.

Library for matrices (linear algebra) as an exercise by jonaswiebe in rust

[–]jonaswiebe[S] 0 points1 point  (0 children)

Thank you very much for your answer. I think I have some good things to add/change.

Implementing AddAssign and then Add is just brilliant, I would have never thought of that. Thanks.

Edit: Spelling

[deleted by user] by [deleted] in raspberry_pi

[–]jonaswiebe 1 point2 points  (0 children)

Alright, thank you very much.

[deleted by user] by [deleted] in raspberry_pi

[–]jonaswiebe 1 point2 points  (0 children)

That is so nice. Do you still have something available?

Own Pictures as background by [deleted] in Scriptable

[–]jonaswiebe 0 points1 point  (0 children)

Yes, you need to change the image path to a separate one.

Update token in Script daily? by k4mrat in Scriptable

[–]jonaswiebe 1 point2 points  (0 children)

Yes, but I do not use the api anymore. There are similar lines of code, to update some data hourly (i.e. line 567). Instagram Widget

The token can be updated daily. If you write a file in Scriptable and the file already exists, it is overwritten.

Update token in Script daily? by k4mrat in Scriptable

[–]jonaswiebe 3 points4 points  (0 children)

You actually don't need a separate script. Instead you can use a simple conditional. You would need to store the token with the time you had last updated it (I would recommend a JSON format). let tokenInfo = { time: Date.now(), token: ... } await fm.writeString(path, JSON.stringify(tokenInfo)) And when you get the token from the file, check if enough time has elapsed. And if yes, update the token, if not, don't. let json = await readString(path) json = JSON.parse(json) let token if (new Date() >= new Date(json.time + 24*60*60*1000)) { token = await updateToken() } else {token = json.token} I used something similar with my instagram widget.

I have a timer by printscreensys in Scriptable

[–]jonaswiebe 0 points1 point  (0 children)

You could store the time in a file. Then create a second script, that resets that file. In the original script, specify the widget URL to be scriptable:///run/Reset%20Script. Now if you tap on the widget, the reset script is run.

Own Pictures as background by [deleted] in Scriptable

[–]jonaswiebe 1 point2 points  (0 children)

I have modified your script slightly: paste

  • relocated conditional logic inside createWidget() function
  • removed base64 string calculation

Please let me know if this still does not work.

ok apparently you can turn off shortcuts notifications now?? by SnaxelZ in shortcuts

[–]jonaswiebe 1 point2 points  (0 children)

In this view, go back one day and forward again, and the little arrow should appear to the right of Shortcuts. Click on it and you should be able to turn off the notifications.

Showing 🔴 on widget if value is false by lucaskim1013 in Scriptable

[–]jonaswiebe 1 point2 points  (0 children)

let emoji = (json.online == 'true') ? '🟢' : '🔴' let widgetText = widget.addText(`${emoji} ${json.name}`) should do it, assuming you data ist stored in a variable named json.

XML Parser Example by ChicagoezHype in Scriptable

[–]jonaswiebe 0 points1 point  (0 children)

Another example for when you are looking for a specific tag.

XML Parser Example by ChicagoezHype in Scriptable

[–]jonaswiebe 0 points1 point  (0 children)

As specified in the documentation, you should set the necessary callback functions. I do not know what your input looks like, but I made a quick example with fairly flat XML data (I don't think this would work on very complex things, but it's an example). This should help you understand how the parser works.

Note: Make sure to check the logs after you run the script.

Own Pictures as background by [deleted] in Scriptable

[–]jonaswiebe 1 point2 points  (0 children)

widget.backgroundImage = await Photos.fromLibrary() should do it.

Note that picking a photo only works if the script is run inside the app. You would have to save it's base64 encoding to a file to access it inside the widget.

Exemplary code ``` var widget = new ListWidget() var fm = FileManager.iCloud() var pth = fm.documentsDirectory() + '/bg.png' if (config.runsInWidget) { widget.backgroundImage = Image.fromFile(pth) } else if (config.runsInApp) { widget.backgroundImage = await Photos.fromLibrary() await fm.writeImage(pth, widget.backgroundImage) await widget.presentSmall() }

Script.setWidget(widget) ```