#async await
Explore tagged Tumblr posts
gbhbl · 1 year ago
Text
EP Review: Async Await - Irretrospective: Part 3 (Chameleons Risen)
Last, but not least, it’s Irretrospective Part 3. The final entry in this trilogy of EPs from Async Await.
Async Await’s charismatic, genre mixing EP collection concludes with Irretrospective: Part 3. Releasing on the 19th January 2024 via Chameleons Risen, the third offering from this series sees a shift as thematically the EP explores self-reflection and improvement. Project mastermind Mike Sorensen comments: Irretrospective Part 3 is the final installment of the Irretrospective series of EPs and…
Tumblr media
View On WordPress
0 notes
kanna-banana · 2 years ago
Text
yeah it sucks when your code isn't working but is there a better feeling than figuring out how to fix and then looking back and understanding exactly why it didn't work and what you did wrong?
probably, but this is the vibe for tonight
10 notes · View notes
haifon-ina · 2 years ago
Text
2 notes · View notes
streetlights-was-taken · 5 months ago
Text
I need to switch gears and plan a dnd session... but I really want to continue writing fic instead...
I reached a good stopping point for the halting problem though, so I guess I should stop now before I get too engrossed in it again. some updates:
unfortunately I think I'll separate qiao ling's story into its own fic. sigh. so this is gonna be a trilogy, huh? I do have it finished though (at 7.8k words, pending final edits). I am also halfway done with cheng xiaoshi's story, async/await (also around 7k words; I estimate it'll be around 15k words total). once I'm done with both, I can finally, finally start lu guang's story, which is supposed to be the main/first fic in the fic series lol (might be a 30k word fic, initial estimate only). so I can't really post anything I've written until then...
anyway. some snippets from both fics.
from qiao ling's fic, predictive execution. interestingly, I get to explore qiao ling's budding alliance with li tianchen and liu xiao. these are relationships that I did not, in a million years, think I would ever explore. but here we are.
Tumblr media Tumblr media
from cheng xiaoshi's fic, async/await: (aka the xiaochen epilogues)
Tumblr media Tumblr media
0 notes
codewithnazam · 2 years ago
Text
Mastering Asynchronous with JavaScript Promise allSettled()
Introduction to JavaScript Promises What are Promises? When to Use Promises? Benefits of Promises Creating Promises with the Promise Constructor Understanding the allSettled() Method Functionality of allSettled() Differences from Promise.all() When to Use allSettled() Benefits of Using allSettled() Handling Multiple Asynchronous Operations Simultaneously Dealing with Mixed Fulfilled and…
View On WordPress
0 notes
codemerything · 2 years ago
Text
A structured way to learn JavaScript.
I came across a post on Twitter that I thought would be helpful to share with those who are struggling to find a structured way to learn Javascript on their own. Personally, I wish I had access to this information when I first started learning in January. However, I am grateful for my learning journey so far, as I have covered most topics, albeit in a less structured manner.
N/B: Not everyone learns in the same way; it's important to find what works for you. This is a guide, not a rulebook.
EASY
What is JavaScript and its role in web development?
Brief history and evolution of JavaScript.
Basic syntax and structure of JavaScript code.
Understanding variables, constants, and their declaration.
Data types: numbers, strings, boolean, and null/undefined.
Arithmetic, assignment, comparison, and logical operators.
Combining operators to create expressions.
Conditional statements (if, else if, else) for decision making.
Loops (for, while) for repetitive tasks. - Switch statements for multiple conditional cases.
MEDIUM
Defining functions, including parameters and return values.
Function scope, closures, and their practical applications.
Creating and manipulating arrays.
Working with objects, properties, and methods.
Iterating through arrays and objects.Understanding the Document Object Model (DOM).
Selecting and modifying HTML elements with JavaScript.Handling events (click, submit, etc.) with event listeners.
Using try-catch blocks to handle exceptions.
Common error types and debugging techniques.
HARD
Callback functions and their limitations.
Dealing with asynchronous operations, such as AJAX requests.
Promises for handling asynchronous operations.
Async/await for cleaner asynchronous code.
Arrow functions for concise function syntax.
Template literals for flexible string interpolation.
Destructuring for unpacking values from arrays and objects.
Spread/rest operators.
Design Patterns.
Writing unit tests with testing frameworks.
Code optimization techniques.
That's it I guess!
872 notes · View notes
felixcloud6288 · 1 year ago
Text
I MANAGED TO GET THE CODE TO WORK THE WAY I WANTED!!!
The version @jv made is effective, but it skips the boop animations. Mine interacts directly with desktop elements so it shows the animations.
Code:
var annoy = async function(){ const sleep = (t) => new Promise(resolve => setTimeout(resolve, t)); while(true){ await sleep(3000) var e = document.getElementsByClassName("TRX6J juYLo") e[0].click() await sleep(50) var f = document.getElementsByClassName("EvhBA Evj9j") f[0].parentElement.click() } }
annoy()
Use the tutorial from jv's post here, but put my code instead. You don't need to specify a victim or number. It chooses the first person on the page and runs forever.
For best results, go to the page of a post from the person you want to annoy.
183 notes · View notes
sztupy · 8 months ago
Text
AutoBooper
Paste this into your browser's console (after allowing paste) and it will boop everyone on your dash constantly. Tested with Firefox only. Reload the page to exit:
const finished = {};
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const autoBoop = async () => {
for (const a of Array.from(document.querySelectorAll('button')).filter(el => el.textContent === 'Boop')) {
if (!a.classList.contains("finished")) {
a.classList.add("finished");
a.click();
await delay(1000);
let btn = Array.from(document.querySelectorAll('button')).find(el => el.textContent === 'BOOp');
if (btn) btn.click();
await delay(1000);
}
};
window.scrollTo(0, document.body.scrollHeight);
await delay(5000);
await autoBoop();
};
autoBoop();
38 notes · View notes
sufficientlylargen · 1 year ago
Text
I don't know who needs to hear this, but
async function boop(n=100, user= "sufficientlylargen", type="super", delay=100) { for (let i = 0; i < n; i++) { await tumblr.apiFetch("/v2/boop", { method: "POST", body: { receiver: user, context: "post", type: type, }}) await new Promise(r => setTimeout(r, delay)) } } boop(1000, "sufficientlylargen", "super", 1000)
51 notes · View notes
itsjunetime · 4 months ago
Text
tier list of rust std modules let's go
Tumblr media
Rationale below the break
S
clone: It’s so important. You gotta be able to clone data around, and you gotta be able to restrict that ability. Crucial
collections: I use this every-fucking-where. Gotta have my HashSet, gotta have by BTreeMap. You know it
future: Love writing futures, love constraining futures, love all of that. And I gotta have that Future trait.
iter: Literally #1 - fucking love my iterations, wish I could write literally everything as an Iterator
option: Option is so fundamental. So many helper methods on it as well, beautiful functionality
ptr: If you’ve ever written complex ffi bindings or collections replacements, you know what I mean. The documentation is phenomenal and only getting better, the provenance projects are making it even even better.
result: Same rationale as option
sync: Arc my beloved. Also channels, mutexes, RwLocks, Atomics, etc, are all so important. Can’t do anything in multi-threaded code without using at least one of them.
vec: We all love Vec. I don’t think I need to explain myself.
A
alloc: Pretty cool and good, would love to see the allocator API stablized and then this would easily be an S tier
array: Manipulating arrays is very nice and good and useful, I just don’t don’t do it enough to put this in S
boxed: Love Box! Really nice and useful. Not something you’ll use in your every-day rust app, though, you only start using it once you’re really getting into the weeds or interacting with futures outside of async/await
cell: Very important to a lot of underlying abstractions in Rust, but just not something most people will really ever use (at least in my experience)
cmp: Useful utilities. Love the way they’re integrated with the langauge operators. V cool.
convert: Also useful! Love my (Try)?(From|Into)
default: Useful sometimes, but I feel like it’s abused occasionally. Also not a fan of seeing Default::default() where someone could’ve used the type name
fs: Gotta interact with a filesystem. Just feel like most rust apps spend most of their time not interacting with a filesystem.
marker: Very important, but most people won’t be interacting with these again.
mem: Love these, very useful, but mostly only useful for specific scenarios.
ops: Hugely important as well, obviously, but most people won’t ever actually manually access this module.
slice: Love manipulating slices - getting chunks, windows
B
borrow: Love Cow, but the whole Borrow vs AsRef thing still confuses me. I understand how they’re different, but I don’t quite understand the historical and tehcnical reasons for it, and feel like there could’ve been a better solution found to avoid this.
arch: Cool and such, but rarely used and a lot of the coolest stuff (portable simd) is still experimental and I rely on it a lot for performance reasons and really want it to stabilize soon.
error: std::error::Error. Woohoo
fmt: Nifty and such. It’s just kinda boring in comparison to all the other cool language features that exist in the standard library.
io: Cool, I guess. I just rarely every use it directly, I guess. And I am also kinda annoyed that AsyncRead and AsyncWrite aren’t things but also I think that the Async variants of traits could be avoided if people wrote more libraries in the sans-io style, so idk
panic: Mmm. I’m glad that the language provides a way for you to clean up during a panic, but I am personally really annoyed that panics are, in the end, recoverable. Irks me.
path: Path and PathBuf woohoo. Also tho such a pity that this module has to be a lot more complex due to windows backwards path separator bullshit. ugh
rc: Rc. Woohoo. I don’t like Rc much personally, I’ve written a lot of code in Rust and I’ve yet to encounter a scenario where I think “This situation could be solved or even helped by an Rc!”. But I understand its uses I guess.
str and String: Useful, yeah, but I’ll always be a bit pissed that they didn’t call them String and StringBuf instead (like they did with Path and PathBuf). Causes way too much confusion to early-on rust users
task: Useful, but I don’t get why they aren’t in future instead. Like, I guess they are used for streams and such, but still.
time: Fine… I guess it’s useful for people to be able to measure elapsed durations for logging and such and easy benchmarking but I just have a natural, deep-seated fear of any computer code that tries to interact with time as a concept so I’m very leery of this.
C
any: Mmmmmm I know it’s useful but I kinda hate that dyn Any is a thing you can do. It should (hopefully) become somewhat less prevalent now that trait upcasting is stabilized, though.
env: Used to be higher, but the whole ‘Linux makes no guarantees about accessing the environment from multiple threads’ thing irks me. I know it’s not Rust’s fault, but I’m still punishing them for it.
ffi: Confuses me that there’s so much duplication between this and os::raw - don’t like it. I know it doesn’t really matter which one you use, but whatever.
hash: Rarely actually interact with it directly. I know that it has to exist to facilitate (Hash|BTree)(Map|Set) but I don’t know what other use it has
net: Nearly all the time that I want to interact with stuff like TcpStream, I would rather use some async-specific net structs, such as are found in tokio.
num: Useful and cool, but I really think that this is seriously missing the traits from the num crate. There’s probably some specific reason why they don’t want to provide this, but the ability to reason around numeric attributes would be so useful.
os: OsStr and OsString suffer from the same sin as str vs String, but also are just inherently confusing due to the complexity that surrounds file paths in different OSes. I know that rust just surfaces all this complexity that hides beneath the surface but that doesn’t keep me from feeling like there was probably some better way to set up these structs
process: std::process::exit. woohoo
thread: Rarely do I spawn a thread manually - generally I want to use tokio or rayon or crossbeam or something like that. Good and useful, just rarely reached to and generally you’d be better off touching something else
D
backtrace: Good for one thing alone, which can be nice for quick and easy debugging, but if you just want a backtrace, a panic!() is easier, and if you can’t do that for whatever reason, you should probably just reach for a full debugger at that point
hint: Just like compiler fuckery. Love it, I do, but rarely do people interact with it, if ever, and really only useful for benchmarks and low-level atomic stuff (which, when I’ve done that, idk if I’ve even seen any sort of performance gains from spin_loop() sooo)
pin: Yes it’s important, but the constant struggle to make it not horrible to use for library developers really irks me. Still no way to (safely) match on pinned enums, no built-in pin projection without macros, etc. Ugh.
prelude: Yeah sure, whatever. You’ll never touch this.
primitive: This does need to exist, but if you’re reaching for this, you’ve fucked up. What are you doing.
F
ascii: I feel like this was a mistake. There are 4 things in it and 2 of them are deprecated. What are we doing.
char: Too many weird things here. Why does to_lowercase return an iterator? Why are these constants not in the primitive type instead? The whole escape stuff also feels arbitrary, and that’s part of the sin of the ascii mod.
f32 and f64: Everything here should be relegated to the primitive types. No need for these. Why are the integer types deprecated while this one isn’t? idk
(I also posted basically this exact same thing on my blog, june.cat, if that sort of thing interests you :))
6 notes · View notes
gdscript-official · 7 months ago
Note
How are you better than Python?
Well!!! idunno kinda depends how you look at it
python is for sure faster and has a much larger standard library, and many more meta programming features, along with the bazillion packages on pypi etc. it also has stuff like exceptions that gdscript lacks
but i do think theres areas where its lacking if u compare the two. In particular i think async is much much nicer in gdscript. 99% of that is because its made in the context of a game engine where you gotta do actions on a frame-by-frame basis which cannot be blocking. so pretty much all the standard apis on nodes and such can be used in an async way with signals & await/connect. Its also really trivial to mix sync & async code, since calling async code from sync just queues it & returns instantly, which is rly intuitive i think. or just doing like .call_deferred()
The whole signal thing also means that pretty much any addon you download can be easily used like this too, whereas in python land its kind of miserable.
also also of course gdscript has actually enforced typing. and its gradual just like pythons! in python land they depend on the IDE to do the type checking ahead of time, which ive always found weird for such a dynamic language. maybe someone's made a package for it or something though? not that gdscript typing is perfect, something like ? to indicate nullable types would be nice i think.
there's probably many more comparisons to be made but those were the first 2 that came to mind :P
2 notes · View notes
gbhbl · 2 years ago
Text
Interview: Async Await aka Mike Sorensen (Video/Audio)
We spoke to multi-instrumentalist Mike Sorensen aka Async Await about the new EP, the plan for the three-parts, looking back while also moving forward, and so much more.
Alternative rock project Async Await will unleash Irretrospective Part 1, the first of a trio of EPs, on the 15th of September 2023 via Chameleons Risen. A dynamic blend of alternative rock, electronica, and distortion, Async Await showcases a varied sound across the four tracks that make up this EP. Read our full review here. We spoke to multi-instrumentalist Mike Sorensen aka Async Await…
Tumblr media
View On WordPress
0 notes
transienturl · 11 months ago
Text
Hrmmmm.
I have a piece of code that (simplified) takes an array of values, runs a fetch corresponding to each value, and does something with the results (in order). The naive way to do this runs all of the fetches in sequence, which is of course slow.
for (const value of someValues) { const result = await fetch(value); console.log(result); }
The slightly less naive way to do this (Promise.all) fires all of the fetches at the same time, which is fine if you have a small number, but not so much if you have a big number. Ideally you would want to do a specific configurable number of fetches at once.
Obviously this isn't hard to do if you write your code that way in advance. I was trying to think of a way to do a helper function that could be used to replace the naive way with a minimal change to the code, though.
In a way, I actually already had one of these (this gist needs more comments; the technique is quite cool imho but it's a bit of a fun puzzle to understand):
This is nice for medium-sized arrays where you're okay with waiting until all of the fetches to resolve before you do anything else with them. But for really large arrays, it's nice to be able to do stuff with the results incrementally. I had this idea:
const batchCallAsync = (inputValues, cb, batchSize) => { const results = []; const values = [...inputValues]; let waitForPreviousBatch = Promise.resolve(); while (values.length) { const resultBatch = values.splice(0, batchSize).map( (value) => new Promise((resolve) => { waitForPreviousBatch.finally(() => resolve(cb(value))); }) ); waitForPreviousBatch = Promise.allSettled(resultBatch); results.push(...resultBatch); } return results; };
This, when run, instantly generates an array of promises, but the promises execute fetches and resolve in batches. You can thus do e.g.
for await (const result of batchCallAsync(someValues, fetch, 5)) { console.log(result) }
and the log statements will come out in real time as the fetches occur. Neat. Could use some refactoring (and a performance improvement to match that gist), but whatever.
Problem, though: you can't cancel this. If you call this on an array of length 3500, you are getting 3500 fetches executed even if you break that for loop (unless you close node/your browser tab). That's not true of the original snippet.
I'm pretty sure it's possible to solve that, too? This seems like the ideal use case for an async generator function. Haven't bothered to write it, yet, but it should be quite simple in principle.
2 notes · View notes
streetlights-was-taken · 5 months ago
Text
the Worst Possible Way™
re: tags in this post from the main blog. I have, in fact, thought of what a potential Worst Possible Way is. this is exactly the fic premise for RE:cursion and async/await (I have decided now to make them two separate fics instead of bunching them all in one fic).
huge major spoilers I guess. not that it's published anyway since it'll take me forever to write, but I guess if you found this post and want to read the fic in the future, uhhh. spoilers abound.
okay I don't think I ever actually wrote down here what the full idea for RE:cursion is, so I'm gonna take this opportunity to talk about it!
Tumblr media
so! here's the thing. the Worst Possible Way for cheng xiaoshi to find out people lie to him, imo, is if the method he finds out makes him feel abandoned. it doesn't matter that the others didn't intend for him to feel that way. it's his primary trauma, and trauma doesn't think through logic. I think that's the only way he'll truly blow up and become an emotional mess. he's quite level headed otherwise and pretty mature (all things considered) when it comes to conflicts. see: post-earthquake arc with lu guang, bridon argument with qiao ling. so if the others decide to just talk it out with him, I believe he wouldn't be that mad.
but we love stories, and stories need conflict.
so! an example of the Worst Possible Way:
you are cheng xiaoshi, and your heart stopped at the river bank. ... and then you wake up. alone.
I'm using second person pov here but the story is mostly in close third person limited.
I've been thinking about this possibility for a bit. a person can die and sometimes they can be revived. what happens to their abilities when that happens? if they transferred it, does the ability get retained by the person who was revived, or the person who got it from them? and so on, and so forth.
but we're not talking about technicalities. we're talking about the emotional journey.
so imagine:
you drown. your heart stops. you "technically" die. your best friend panics and can't get you back, but he's been through this before. he knows what to do now. he quickly finds his backup photo — he's had this ready for a while. it's been a while for him; it's automatic now. routine, even. he doesn't have to doubt or think. it's instinct. he claps outs. disappears. someone gets to you in time and stabilizes you. revives you. you wake up alone. you don't know what happened, or why, but the facts are: your best friend isn't here. he left you to die.
"but streetlights, if you change the past then the present can't exist! the closed loop! the timelines!" I've thought about the logistics of it, it's okay. thank god liu xiao mentioned parallel lines.
"but streetlights, cheng xiaoshi would give him the benefit of doubt, surely?" in any other scenario, I agree with you. in this one? you don't think rationally when someone hits your trauma point. also the scene logistics are arranged so that cheng xiaoshi actually did hear the clap before he died (his heartbeat was there but too faint to get picked up by lu guang... not by someone else though). also liu xiao is there to control all the hospital scenes lmao. he's gonna make sure everyone sticks to my fic script. (he's such a convenient character to write).
anyway, so I'm still fleshing out the story, but man would that suck for cheng xiaoshi huh. he doesn't know what actually happened but like... it doesn't matter? he was left behind! he left! they all leave. he's known this since he was a kid, so he shouldn't have been surprised, and yet...! etc etc you get it. he gets a panic attack at the hospital. he eventually decides to "rescue" lu guang from the new (parallel) timeline he jumped to and bring him back to their home timeline (oof this one requires squeezing my brain to make it work with time travel rules, especially since they do stay past 12h in the new timeline. but I am. trying my best. I can make it work. this fic relies on a couple of axioms we just gotta accept to be true for the fic to work, like how lu guang is actually jumping to parallel timelines and it's the high five that has anchored cheng xiaoshi into his home timeline whenever he dives, which is why they never noticed. anyway, I still have to iron out the details, but maybe I'll post the technical stuff another time. devil's in the details and all that.)
so like. I think cheng xiaoshi in this scenario (cheng xiaoshi hopping into the parallel timeline lu guang is in to bring him back) is uniquely devastating from his perspective. his best friend has been time looping all this time. he understands why, of course he does, but... does he know cheng xiaoshi lived past his death? did the others xiaoshis live too? how many xiaoshis has he abandoned before him? and if he dies again, and lives again, will lu guang leave him again as well? is that their fate? cheng xiaoshi is trying so hard not to spiral here. he empathizes with lu guang, but can't help but feel resentful.
and like, this new timeline is kinda nice. it's peaceful. he can't blame lu guang for wanting a new home. but this isn't home, is it? he has to bring him back. but would he want to? would he believe him? he's seen him die in every loop, after all. etc etc.
so now imagine lu guang thinking he's keeping a secret from this timeline's cheng xiaoshi (the whole timeloop thing), meanwhile this cheng xiaoshi is also hiding a secret (that he knows and he's from the previous timeline and he wants his lu guang back). cheng xiaoshi dealing with both trauma and empathy; understanding and resentment.
so yeah. a potential Worst Possible Way :)
but all of the above are just like. the side story. the thing that happens before the main story. the actual main story is lu guang facing his psychological horror trip in the parallel timeline because:
his dive ability is not working properly (because cheng xiaoshi woke up, so the power transfer kinda gets fucked) and he doesn't know why. it left him with gaps in his memories, and he can't afford to forget anything because he has to have control over the timeline nodes
this timeline's cheng xiaoshi is acting WEIRD. he's extra clingy yet also distant. he's not supposed to know about his time travel ability yet (this is yingdu timeline lol, so it's their university years) but he seems to imply that he does? but then says he's just joking? he's taking an interest in lu guang's books now (??), specifically mentioning ship of theseus and temptation of thanatos and like. wtf is happening? does he know? how? and why does he seem sadder in this timeline... and like he's hesitant to trust lu guang sometimes but he says he wants to, or he doesn't think lu guang really means it when lu guang said he'll stay with him... what happened to this timeline's xiaoshi :(
I haven't worked out the RE:cursion scenes yet but I'm imagining a scene where they pass by emma and cheng xiaoshi just kinda goes !! and can't help but talk to her, and lu guang is like, "wtf, he's not supposed to know her yet? is this gonna fuck up the timeline?" and cheng xiaoshi simply tells him, "oh yeah, I don't know her, I just thought she was pretty. and kinda lonely." and they both know he's lying. does lu guang call him out on it? is he brave enough? he didn't question him in the yingdu episodes thus far, so...
lu guang just has an uneasy feeling that something is very wrong with this timeline. he doesn't know what, and doesn't like it at all. and the story is about the slow unraveling of this mystery, in such a way that it dawns on the reader first what happened, before lu guang puts it all together.
which is worse: to be the one that was left behind to die? or to be the one to unknowingly leave your best friend to die alone?
a timeline where you successfully moved past a death node and kept everyone alive, and yet you still left. the very problem you've spent all these timelines trying solve has been solved, and yet you still fuck it up so bad because you're so used to looping.
it's the advanced time loop problem. in a timeloop scenario, especially a self-inflicted one, you are prone to falling into the trap that "there's always the next loop." it's similar to what I did with my other time loop fic. to quote:
a time loop is a puzzle. it really is! often, the character is already stuck in some way before the time loop starts, and the time loop breaks when they either achieve character development or break the puzzle that is trapping them. I think lumine and venti approach the time loop puzzle from opposite ends. lumine regresses through her time loop. she becomes less connected to the world through it, and she aims for perfection that she can’t achieve. she starts seeing her friends as more like characters in an unskippable cutscene than as people.
in RE:cursion, lu guang is going through a similar arc like lumine. "there's always the next loop" is a dangerous statement to start thinking.
I also want to quote this tumblr post, which explains it better than I could.
Love a self-inflicted time loop. The main character isn’t trapped. They can stop whenever they want. But how can they when things aren’t perfect yet? They can do better than this. They need to try again. They can get it right this time. They just need to try again. They can stop anytime they want. Just one more time. They can fix this. They just need to try again. There are still things to fix. They just need to try again.
the horror is in this: what if you didn't need to fix it anymore, and yet you still loop? what if you start breaking things, instead of fixing them, because you're so deep into your timeloop mentality and grief? you grieve them while they're alive that you can't see them as living anymore.
and he knows. he knows it all. you don't know that he knows, but the fact that he knows will haunt the narrative. because this time, this isn't dream!cxs haunting your nightmares. he's real and he's right beside you and he knows. and he's asking, "is there something you want to tell me, lu guang?"
so. yeah! now imagine all of THAT as in interactive choose your own adventure fic. does it have to be in an interactive format? nope. but I think the horror increases tenfold in that format. the reader becomes a participant in the story. every choice they make is them consenting to see the next scene, even if they don't like where it's going. every choice they make means there is a choice they don't make, which carries its own weight as well. it's also like, standard butterfly effect stuff in text format. I just think an interactive fic is a very link click thing to do, storytelling-wise. like, paying homage or something. there's a lot you can do with unreliable narrators and such, and it makes the actual time looping feel extra fucked up.
anyway. yeah. the main story is primarily told through lu guang, but at its core it was always about a traumatized cheng xiaoshi. what can I say... I love to whump xiaoshi................
0 notes
codewithnazam · 2 years ago
Text
Mastering Asynchronous with JavaScript Promise allSettled()
Harness the power of Promise.allSettled() to handle multiple asynchronous operations with ease in JavaScript. This comprehensive guide teaches you everything you need to know.
Introduction to JavaScript Promises What are Promises? When to Use Promises? Benefits of Promises Creating Promises with the Promise Constructor Understanding the allSettled() Method Functionality of allSettled() Differences from Promise.all() When to Use allSettled() Benefits of Using allSettled() Handling Multiple Asynchronous Operations Simultaneously Dealing with Mixed Fulfilled and…
View On WordPress
0 notes
lorwolf-salt · 1 year ago
Note
It is obvious that LW does not have an activity log. Otherwise, these 24/7 botters would have been caught a long time ago. Gonna send in a script for the final goldsea area. Can be customized. Will leave it up to the blog owners if they want to share it.
Run it through ChatGBT to fix the spacing. :) // ==UserScript== // @name Lorwolf Automation Script Goldsea // @namespace http://tampermonkey.net/ // @version 1.0 // @description Automate actions on Lorwolf website // @author YourName // @match https://www.lorwolf.com/Campaign/Explore?id=16 // @grant none // ==/UserScript== (async function () { 'use strict';let timer; function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function randomSleep() { const randomInterval = Math.random() * (0.85 - 0.45) + 0.45; return sleep(randomInterval * 1000); } function refreshPage() { location.reload(); } async function automateActions() { const pageText = document.body.innerText; const staminaElement = document.querySelector('.lockedPartyMemeber'); if (staminaElement) { const currentStamina = parseInt(staminaElement.dataset.currentStamina); if (currentStamina <= 20) { const feedAllButton = document.querySelector('.btn.btn-green.btn-xs.btn-fill.partyFeedAllButton'); if (feedAllButton) { feedAllButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } const closeButton = document.querySelector('span[aria-hidden="true"]'); if (closeButton) { closeButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } } if (pageText.includes("Encounter: Moth")) { await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const mustCatchButton = document.querySelector('div[data-option-id="0"]'); if (mustCatchButton) { mustCatchButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } else if (pageText.includes("Battle: Broch")) { await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const attackButton = document.querySelector('div[data-option-id="0"]'); if (attackButton) { attackButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } else if (pageText.includes("Battle: Vespen")) { await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const attackButton = document.querySelector('div[data-option-id="0"]'); if (attackButton) { attackButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } else if (pageText.includes("Discover: Something?")) { await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const continueButton = document.querySelector('div[data-option-id="0"]'); if (continueButton) { continueButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } else if (pageText.includes("Encounter: Wild Wolf")) { await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const befriendButton = document.querySelector('div[data-option-id="0"]'); if (befriendButton) { befriendButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds const wagTailButton = document.querySelector('div[data-option-id="1"]'); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds if (wagTailButton) { wagTailButton.click(); await randomSleep(); // Wait for a random time between 1.25 and 1.8 seconds location.reload(); } } } // Set a timer to refresh the page after 10 seconds of inactivity timer = setTimeout(refreshPage, 10000); } // Call automateActions initially await automateActions(); // Add an event listener to reset the timer on user activity document.addEventListener('mousemove', function () { clearTimeout(timer); timer = setTimeout(refreshPage, 10000); }); })();
2 notes · View notes