#JavaScript Scope
Explore tagged Tumblr posts
Text
Javascript functions interview questions, Closures & ES6 Part 2
javascript functions interview questions including closures, scope, IIFE, prototypes, and currying. Essential for frontend developers preparing for technical interviews in 2025. Javascript functions interview questions 🚀 Javascript functions interview questions 🚀 Javascript functions interview questions16. What is a Closure in JavaScript?17. What is Scope in JavaScript?18. What is the…
#advanced JavaScript interview questions#currying in JavaScript#JavaScript closures#JavaScript IIFE#JavaScript scope#JavaScript technical interview#prototype in JavaScript
0 notes
Text
Good Code is Boring
Daily Blogs 358 - Oct 28th, 12.024
Something I started to notice and think about, is how much most good code is kinda boring.
Clever Code
Go (or "Golang" for SEO friendliness) is my third or fourth programming language that I learned, and it is somewhat a new paradigm for me.
My first language was Java, famous for its Object-Oriented Programming (OOP) paradigms and features. I learned it for game development, which is somewhat okay with Java, and to be honest, I hardly remember how it was. However, I learned from others how much OOP can get out of control and be a nightmare with inheritance inside inheritance inside inheritance.
And then I learned JavaScript after some years... fucking god. But being honest, in the start JS was a blast, and I still think it is a good language... for the browser. If you start to go outside from the standard vanilla JavaScript, things start to be clever. In an engineering view, the ecosystem is really powerful, things such as JSX and all the frameworks that use it, the compilers for Vue and Svelte, and the whole bundling, and splitting, and transpiling of Rollup, ESBuild, Vite and using TypeScript, to compile a language to another, that will have a build process, all of this, for an interpreted language... it is a marvel of engineering, but it is just too much.
Finally, I learned Rust... which I kinda like it. I didn't really make a big project with it, just a small CLI for manipulating markdown, which was nice and when I found a good solution for converting Markdown AST to NPF it was a big hit of dopamine because it was really elegant. However, nowadays, I do feel like it is having the same problems of JavaScript. Macros are a good feature, but end up being the go-to solution when you simply can't make the code "look pretty"; or having to use a library to anything a little more complex; or having to deal with lifetimes. And if you want to do anything a little more complex "the Rust way", you will easily do head to head with a wall of skill-issues. I still love it and its complexity, and for things like compiler and transpilers it feels like a good shot.
Going Go
This year I started to learn Go (or "Golang" for SEO friendliness), and it has being kinda awesome.
Go is kinda like Python in its learning curve, and it is somewhat like C but without all the needing of handling memory and needing to create complex data structured from scratch. And I have never really loved it, but never really hated it, since it is mostly just boring and simple.
There are no macros or magic syntax. No pattern matching on types, since you can just use a switch statement. You don't have to worry a lot about packages, since the standard library will cover you up to 80% of features. If you need a package, you don't need to worry about a centralized registry to upload and the security vulnerability of a single failure point, all packages are just Git repositories that you import and that's it. And no file management, since it just uses the file system for packages and imports.
And it feels like Go pretty much made all the obvious decisions that make sense, and you mostly never question or care about them, because they don't annoy you. The syntax doesn't get into your way. And in the end you just end up comparing to other languages' features, saying to yourself "man... we could save some lines here" knowing damn well it's not worth it. It's boring.
You write code, make your feature be completed in some hours, and compile it with go build. And run the binary, and it's fast.
Going Simple
And writing Go kinda opened a new passion in programming for me.
Coming from JavaScript and Rust really made me be costumed with complexity, and going now to Go really is making me value simplicity and having the less moving parts are possible.
I am becoming more aware from installing dependencies, checking to see their dependencies, to be sure that I'm not putting 100 projects under my own. And when I need something more complex but specific, just copy-and-paste it and put the proper license and notice of it, no need to install a whole project. All other necessities I just write my own version, since most of the time it can be simpler, a learning opportunity, and a better solution for your specific problem. With Go I just need go build to build my project, and when I need JavaScript, I just fucking write it and that's it, no TypeScript (JSDoc covers 99% of the use cases for TS), just write JS for the browser, check if what you're using is supported by modern browsers, and serve them as-is.
Doing this is really opening some opportunities to learn how to implement solutions, instead of just using libraries or cumbersome language features to implement it, since I mostly read from source-code of said libraries and implement the concept myself. Not only this, but this is really making me appreciate more standards and tooling, both from languages and from ecosystem (such as web standards), since I can just follow them and have things work easily with the outside world.
The evolution
And I kinda already feel like this is making me a better developer overhaul. I knew that with an interesting experiment I made.
One of my first actual projects was, of course, a to-do app. I wrote it in Vue using Nuxt, and it was great not-gonna-lie, Nuxt and Vue are awesome frameworks and still one of my favorites, but damn well it was overkill for a to-do app. Looking back... more than 30k lines of code for this app is just too much.
And that's what I thought around the start of this year, which is why I made an experiment, creating a to-do app in just one HTML file, using AlpineJS and PicoCSS.
The file ended up having just 350 files.
Today's artists & creative things Music: Torna a casa - by Måneskin
© 2024 Gustavo "Guz" L. de Mello. Licensed under CC BY-SA 4.0
4 notes
·
View notes
Text
Purecode | JavaScript is determined lexically
The scope chain in JavaScript is determined lexically, meaning that the nesting of functions and blocks defines the accessible scopes. This allows inner functions to access variables from outer functions but not vice versa. ES6 introduced the let and const keywords to enable block scoping, which restricts variable visibility to the block in which they are declared, providing more predictable behavior compared to var.
#purecode#purecode ai company reviews#purecode software reviews#purecode company#purecode ai reviews#purecode reviews#Javascript#Scope Chain
0 notes
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
Text
i think every programming language should have a couple Silly Ones. string.to1337¢45€(). string.emojify(). number.llmPretendToBeSrinivasaRamanujanAndTellMeAFactAboutThisNumber() etc.
python provides `import antigravity` in the standard library but ideally it should be in global scope.
an example of a language doing this RIGHT is javascript, which provides a very funny "==" operator as a prank.
252 notes
·
View notes
Text
Rambling About C# Being Alright
I think C# is an alright language. This is one of the highest distinctions I can give to a language.
Warning: This post is verbose and rambly and probably only good at telling you why someone might like C# and not much else.
~~~
There's something I hate about every other language. Worst, there's things I hate about other languages that I know will never get better. Even worse, some of those things ALSO feel like unforced errors.
With C# there's a few things I dislike or that are missing. C#'s feature set does not obviously excel at anything, but it avoids making any huge misstep in things I care about. Nothing in C# makes me feel like the language designer has personally harmed me.
C# is a very tolerable language.
C# is multi-paradigm.
C# is the Full Middle Malcomist language.
C# will try to not hurt you.
A good way to describe C# is "what if Java sucked less". This, of course, already sounds unappealing to many, but that's alright. I'm not trying to gas it up too much here.
C# has sins, but let's try to put them into some context here and perhaps the reason why I'm posting will become more obvious:
C# didn't try to avoid generics and then implement them in a way that is very limiting (cough Go).
C# doesn't hamstring your ability to have statement lambdas because the language designer dislikes them and also because the language designer decided to have semantic whitespace making statement lambdas harder to deal with (cough Python).
C# doesn't require you to explicitly wrap value types into reference types so you can put value types into collections (cough Java).
C# doesn't ruin your ability to interact with memory efficiently because it forbids you from creating custom value types, ergo everything goes to the heap (cough cough Java, Minecraft).
C# doesn't have insane implicit type coercions that have become the subject of language design comedy (cough JavaScript).
C# doesn't keep privacy accessors as a suggestion and has the developers pinkie swear about it instead of actually enforcing it (cough cough Python).
Plainly put, a lot of the time I find C# to be alright by process of elimination. I'm not trying to shit on your favorite language. Everyone has different things they find tolerable. I have the Buddha nature so I wish for all things to find their tolerable language.
I do also think that C# is notable for being a mainstream language (aka not Haskell) that has a smaller amount of egregious mistakes, quirks and Faustian bargains.
The Typerrrrr
C# is statically typed, but the typing is largely effortless to navigate unlike something like Rust, and the GC gives a greater degree of safety than something like C++.
Of course, the typing being easy to work it also makes it less safe than Rust. But this is an appropriate trade-off for certain kinds of applications, especially considering that C# is memory safe by virtue of running on a VM. Don't come at me, I'm a Rust respecter!!
You know how some people talk about Python being amazing for prototyping? That's how I feel about C#. No matter how much time I would dedicate to Python, C# would still be a more productive language for me. The type system would genuinely make me faster for the vast majority of cases. Of course Python has gradual typing now, so any comparison gets more difficult when you consider that. But what I'm trying to say is that I never understood the idea that doing away entirely with static typing is good for fast iteration.
Also yes, C# can be used as a repl. Leave me alone with your repls. Also, while the debugger is active you can also evaluate arbitrary code within the current scope.
I think that going full dynamic typing is a mistake in almost every situation. The fact that C# doesn't do that already puts it above other languages for me. This stance on typing is controversial, but it's my opinion that is really shouldn't be. And the wind has constantly been blowing towards adding gradual typing to dynamic languages.
The modest typing capabilities C# coupled with OOP and inheritance lets you create pretty awful OOP slop. But that's whatever. At work we use inheritance in very few places where it results in neat code reuse, and then it's just mostly interfaces getting implemented.
C#'s typing and generic system is powerful enough to offer you a plethora of super-ergonomic collection transformation methods via the LINQ library. There's a lot of functional-style programming you can do with that. You know, map, filter, reduce, that stuff?
Even if you make a completely new collection type, if it implements IEnumerable<T> it will benefit from LINQ automatically. Every language these days has something like this, but it's so ridiculously easy to use in C#. Coupled with how C# lets you (1) easily define immutable data types, (2) explicitly control access to struct or class members, (3) do pattern matching, you can end up with code that flows really well.
A Friendly Kitchen Sink
Some people have described C#'s feature set as bloated. It is getting some syntactic diversity which makes it a bit harder to read someone else's code. But it doesn't make C# harder to learn, since it takes roughly the same amount of effort to get to a point where you can be effective in it.
Most of the more specific features can be effortlessly ignored. The ones that can't be effortlessly ignored tend to bring something genuinely useful to the language -- such as tuples and destructuring. Tuples have their own syntax, the syntax is pretty intuitive, but the first time you run into it, you will have to do a bit of learning.
C# has an immense amount of small features meant to make the language more ergonomic. They're too numerous to mention and they just keep getting added.
I'd like to draw attention to some features not because they're the most important but rather because it feels like they communicate the "personality" of C#. Not sure what level of detail was appropriate, so feel free to skim.
Stricter Null Handling. If you think not having to explicitly deal with null is the billion dollar mistake, then C# tries to fix a bit of the problem by allowing you to enable a strict context where you have to explicitly tell it that something can be null, otherwise it will assume that the possibility of a reference type being null is an error. It's a bit more complicated than that, but it definitely helps with safety around nullability.
Default Interface Implementation. A problem in C# which drives usage of inheritance is that with just interfaces there is no way to reuse code outside of passing function pointers. A lot of people don't get this and think that inheritance is just used because other people are stupid or something. If you have a couple of methods that would be implemented exactly the same for classes 1 through 99, but somewhat differently for classes 100 through 110, then without inheritance you're fucked. A much better way would be Rust's trait system, but for that to work you need really powerful generics, so it's too different of a path for C# to trod it. Instead what C# did was make it so that you can write an implementation for methods declared in an interface, as long as that implementation only uses members defined in the interface (this makes sense, why would it have access to anything else?). So now you can have a default implementation for the 1 through 99 case and save some of your sanity. Of course, it's not a panacea, if the implementation of the method requires access to the internal state of the 1 through 99 case, default interface implementation won't save you. But it can still make it easier via some techniques I won't get into. The important part is that default interface implementation allows code reuse and reduces reasons to use inheritance.
Performance Optimization. C# has a plethora of features regarding that. Most of which will never be encountered by the average programmer. Examples: (1) stackalloc - forcibly allocate reference types to the stack if you know they won't outlive the current scope. (2) Specialized APIs for avoiding memory allocations in happy paths. (3) Lazy initialization APIs. (4) APIs for dealing with memory more directly that allow high performance when interoping with C/C++ while still keeping a degree of safety.
Fine Control Over Async Runtime. C# lets you write your own... async builder and scheduler? It's a bit esoteric and hard to describe. But basically all the functionality of async/await that does magic under the hood? You can override that magic to do some very specific things that you'll rarely need. Unity3D takes advantage of this in order to allow async/await to work on WASM even though it is a single-threaded environment. It implements a cooperative scheduler so the program doesn't immediately freeze the moment you do await in a single-threaded environment. Most people don't know this capability exists and it doesn't affect them.
Tremendous Amount Of Synchronization Primitives and API. This ones does actually make multithreaded code harder to deal with, but basically C# erred a lot in favor of having many different ways to do multithreading because they wanted to suit different usecases. Most people just deal with idiomatic async/await code, but a very small minority of C# coders deal with locks, atomics, semaphores, mutex, monitors, interlocked, spin waiting etc. They knew they couldn't make this shit safe, so they tried to at least let you have ready-made options for your specific use case, even if it causes some balkanization.
Shortly Begging For Tagged Unions
What I miss from C# is more powerful generic bounds/constraints and tagged unions (or sum types or discriminated unions or type unions or any of the other 5 names this concept has).
The generic constraints you can use in C# are anemic and combined with the lack of tagged unions this is rather painful at times.
I remember seeing Microsoft devs saying they don't see enough of a usecase for tagged unions. I've at times wanted to strangle certain people. These two facts are related to one another.
My stance is that if you think your language doesn't need or benefit from tagged unions, either your language is very weird, or, more likely you're out of your goddamn mind. You are making me do really stupid things every time I need to represent a structure that can EITHER have a value of type A or a value of type B.
But I think C# will eventually get tagged unions. There's a proposal for it here. I would be overjoyed if it got implemented. It seems like it's been getting traction.
Also there was an entire section on unchecked exceptions that I removed because it wasn't interesting enough. Yes, C# could probably have checked exceptions and it didn't and it's a mistake. But ultimately it doesn't seem to have caused any make-or-break in a comparison with Java, which has them. They'd all be better off with returning an Error<T>. Short story is that the consequences of unchecked exceptions have been highly tolerable in practice.
Ecosystem State & FOSSness
C# is better than ever and the tooling ecosystem is better than ever. This is true of almost every language, but I think C# receives a rather high amount of improvements per version. Additionally the FOSS story is at its peak.
Roslyn, the bedrock of the toolchain, the compiler and analysis provider, is under MIT license. The fact that it does analysis as well is important, because this means you can use the wealth of Roslyn analyzers to do linting.
If your FOSS tooling lets you compile but you don't get any checking as you type, then your development experience is wildly substandard.
A lot of stupid crap with cross-platform compilation that used to be confusing or difficult is now rather easy to deal with. It's basically as easy as (1) use NET Core, (2) tell dotnet to build for Linux. These steps take no extra effort and the first step is the default way to write C# these days.
Dotnet is part of the SDK and contains functionality to create NET Core projects and to use other tools to build said projects. Dotnet is published under MIT, because the whole SDK and runtime are published under MIT.
Yes, the debugger situation is still bad -- there's no FOSS option for it, but this is more because nobody cares enough to go and solve it. Jetbrains proved anyone can do it if they have enough development time, since they wrote a debugger from scratch for their proprietary C# IDE Rider.
Where C# falls flat on its face is the "userspace" ecosystem. Plainly put, because C# is a Microsoft product, people with FOSS inclinations have steered clear of it to such a degree that the packages you have available are not even 10% of what packages a Python user has available, for example. People with FOSS inclinations are generally the people who write packages for your language!!
I guess if you really really hate leftpad, you might think this is a small bonus though.
Where-in I talk about Cross-Platform
The biggest thing the ecosystem has been lacking for me is a package, preferably FOSS, for developing cross-platform applications. Even if it's just cross-platform desktop applications.
Like yes, you can build C# to many platforms, no sweat. The same way you can build Rust to many platforms, some sweat. But if you can't show a good GUI on Linux, then it's not practically-speaking cross-platform for that purpose.
Microsoft has repeatedly done GUI stuff that, predictably, only works on Windows. And yes, Linux desktop is like 4%, but that 4% contains >50% of the people who create packages for your language's ecosystem, almost the exact point I made earlier. If a developer runs Linux and they can't have their app run on Linux, they are not going to touch your language with a ten foot pole for that purpose. I think this largely explains why C#'s ecosystem feels stunted.
The thing is, I'm not actually sure how bad or good the situation is, since most people just don't even try using C# for this usecase. There's a general... ecosystem malaise where few care to use the language for this, chiefly because of the tone that Microsoft set a decade ago. It's sad.
HOWEVER.
Avalonia, A New Hope?
Today we have Avalonia. Avalonia is an open-source framework that lets you build cross-platform applications in C#. It's MIT licensed. It will work on Windows, macOS, Linux, iOS, Android and also somehow in the browser. It seems to this by actually drawing pixels via SkiaSharp (or optionally Direct2D on Windows).
They make money by offering migration services from WPF app to Avalonia. Plus general support.
I can't say how good Avalonia is yet. I've researched a bit and it's not obviously bad, which is distinct from being good. But if it's actually good, this would be a holy grail for the ecosystem:
You could use a statically typed language that is productive for this type of software development to create cross-platform applications that have higher performance than the Electron slop. That's valuable!
This possibility warrants a much higher level of enthusiasm than I've seen, especially within the ecosystem itself. This is an ecosystem that was, for a while, entirely landlocked, only able to make Windows desktop applications.
I cannot overstate how important it is for a language's ecosystem to have a package like this and have it be good. Rust is still missing a good option. Gnome is unpleasant to use and buggy. Falling back to using Electron while writing Rust just seems like a bad joke. A lot of the Rust crates that are neither Electron nor Gnome tend to be really really undercooked.
And now I've actually talked myself into checking out Avalonia... I mean after writing all of that I feel like a charlatan for not having investigated it already.
72 notes
·
View notes
Text
Homestar Runner just released a toon to commemorate its 25th anniversary of existing as a website.
Let that sink in.
25 years.
Its especially crazy when you realize just how few websites from that era made it out of the 2000s, let alone 2010s, and how much any new website struggles to stay alive today.
As for the cartoon itself, while Homestar Runner really isn't that funny to me anymore, and this cartoon wasn't an exception, watching this gave me a very odd, eerie, hard to articulate feeling.
so let me try to articulate,
i was 13 when i first watched Homestarrunner, and by that time the site was already 16 years old, already a barely relevant, barely alive relic of a bygone era of internet culture that I wasn't even around to see. Not that it mattered to me, as an autistic teenager whos interests were already frequently and completely out of touch with what was relevant to anyone my age. i watched pretty much every toon they ever made, every last sbemail.
I even remember my doomed attempt to make my own Homestar Runner style series, with a pirated copy of flash, crude html skills, and a dream, wondering why I was the only one to pick up the slack on this utterly unique sub-medium of animation.
I'm 21 now, and Homestar Runner now doesn't even just feel old, it feels like something from an entirely different reality, as if my memories of it are totally fake and if I actually look back I'll find out that there was never such a thing as Homestar Runner.
Its probably responsible for influencing much of the shape of internet culture and indie animation, but I can only say "probably". Nothing really links back to it in any tangible sense, you can't trace a lineage of inspiration of any current webseries back to it, and a big part of that is probably due to its format. It primarily existed on its own dedicated website, instead of youtube, or newgrounds, or any pre-youtube video site like gametrailers or screwattack. and on top of that, its production value was more polished than any other flash animation or webseries of its time, and yet its scope and approach to the design of its characters and "world" was ruthlessly efficient and minimalistic.
Where a lot of indie projects aim for big concepts and big style, trying to ape TV animation/anime, Homestar Runner aimed to be very small and quick, with characters somehow less animated than the average stick figure and sharing more of its comedic/narrative DNA with the average weekly comic strip than what most indie animation was trying to be (when it wasn't doing swearing mario parodies). It was a universe barely bigger than your average Garry's Mod TTT map, only as rich and expansive as its most one-off joke. That extreme approach to being the minimum viable product with an above-average quality and consistency gave it a significant edge over most online animation of the time, allowing an (almost) weekly format for its most defining period of relevance.
And all of that is not even getting into how it made the most of being a flash web application with its interactivity. Every single menu on the site, even the plain text buttons under the main window, was a flash element. Every single page jam-packed with interactive animation with a unique skeumorphic approach to menus that puts even the most kitschy, lively DVD menu to shame, and to this day is a breath of fresh air from overly rounded-off and soullessly minimalistic web design of today. And if you clicked on the right nooks, crannies, and lines of text strong bad somehow typed out with his begloved hands, you got a pop-up easter egg or even a little extra bit of cartoon to reward you.
Somehow, none of its approaches to format, or interactivity, or web design ever caught on. It was undeniably a product of its time, of course, the idea of entirely flash websites were an extremely awkward peach-fuzz era between web 1.0 and the integration of javascript and dynamic web elements, but theres a strange, dare I say liminal charm to that. And I can't really humor the idea that its ever going to come back.
Sure, we have the rise of "Old Internet Aesthetics", with people making plain html websites with neocities to try and stroke some hauntological intrigue boner and wax wistful about the lost, wild west era of the internet buried by time, but it remains to be seen whether or not thats ever going to manage to become more than a neat little novelty art project that people eventually abandon because it's so outmoded in its ability to generate clout/dopamine by the digital megacities of Xitter and uhh.. Instagram i guess? And of course, the era of flash websites is hardly as resolute an aesthetic as the web 1.0 html site, so its been completely passed over and will likely see its day in the sun, and neither will the pioneering format of homestar runner unless the entire structure of internet culture bends over backwards.
Its the first and last of its kind, a format never tried before or since, a successful and wildly ahead-of-its-time but nonetheless shelved experiment forever gathering dust, like the laserdisc, or one of those strangely designed pre-apple cellphones, a window into what the internet was, and could have been before the iphone came along and derailed everything.
Its an eerie, abstract kind of feeling.
#homestar runner#old internet#hauntology#liminal aesthetic#long reads#blog#internet culture#internet history#flash animation#newgrounds#neocities
13 notes
·
View notes
Note
Hello ! Hope you are going well !
I'm really interested in the kirby Rpg you're currently making, and I'm regularly keeping an eye onto the development of the project. That's definitely the kind of fangame I'd like to play. As a programmer myself, I wanted to ask : what software / language are you using ? It's just out of curiosity.
Also, I wanted to ask if you needed help regarding the sprites / backgrounds / animations, since you're using placeholders (which is normal at this state of the project). I know from experience that's it's the kind of thing that can take a lot of time. I probably won't have a lot of time to draw in the next months, but I'd be happy to participate. Not pressure if you don't want, that's okay !
Anyways, have a good day / night, I'll wait to see the next update on your project !
Hello there!
I'm currently using RPG Maker which uses JavaScript! I use it since I have planned for the game to be an RPG and because it's very friendly towards people that barely know how to program like I am!
And OHHHHHHH! I'd be completely flattered if you decided to join the project! I had planned to make this game on my own but considering the large scope of the project, some help might prove useful!
10 notes
·
View notes
Text
I currently have my latest blogpost for my website displayed on my front page. If you click on the title, it will take you to the post. I essentially grab the Title, which is a class of h1, and the article, using javascript, and then replace it. However, right now, this is done by manually replacing the href of the javascript. This works; I just create a post, copy the link, and paste it into the script in my home page.
Problem; I am already maintaining my rss feed manually. Why should I do *this* manually? I kind of want to not do either manually.
Solution: Javascript can be used to parse a xml doc. This includes rss feeds. I can simply make a script that, when you load up the webpage, it will request the most recent version of the .xml file associated with my file, then find the one with the most recent pubDate, it will then grab the link from that, and use my existing script to display it on my homepage.
As for updating my rss feed? I may need to create a php script for that. I just need two forms, and a submit button. One will take a link, and the other would be the password. So, I create a new blogpost, upload it, and then copy the link into the form. The password field will be used to create a cryptographic hash, and if it matches the provided one, then it will create a timestamp, and add the item, complete with links, to the html file. I could add in a hidden description to the blogpost, and the script can rip the description from there. Its pretty simple, and I wouldn't trust this authentication process... except that it is extremely limited in scope. All it does is accept a link already part of my blog, and updates an xml document - one I regularly back-up.
I also want to make a script that would get the previous and next posts on the blog, based on the info already in the xml document, rather than manually updating the existing blogposts. It doesn't take long, but it would be one less thing I have to worry about. I just have to match the current link to one in the xml file, get the timestamp, and find the item with the previous and next timestamp, then inject the links into the previous/next buttons. I can use a span element that will be updated to show up once a new document is found by the script.
If I was making one that actually allowed you to write a blogpost - complete with html - then I would want better security - like some form of 2 factor authentication. My authentication script would work. I would also want it limited to posting based on the time (like 1 post per x minutes). I may actually do that later. It would be nice to just go to my site, use my passkey+password authenticator, and then just post to my blog. It would have a form for the title, short description, and the main post. Then, it takes that info, and essentially pastes it into a provided template.
I could also make a similar system for the site-updates and little blurb on the top. Currently, I just edit the html for that. But I could also make an xml document, and just have the posts contained in items like an rss feed, then have the javascript read from there. Use a php script to add new entries to it. They could even be in the same file, just have to use two different elements.
Finally, on the main page, you can click on the title of the blog post to link there. This is done via script, so there is no mouseover indication that you can do this. I want to make the title element change a bit when you mouseover it - perhaps make it a little paler on mouseover?
9 notes
·
View notes
Text
How to Build Software Projects for Beginners
Building software projects is one of the best ways to learn programming and gain practical experience. Whether you want to enhance your resume or simply enjoy coding, starting your own project can be incredibly rewarding. Here’s a step-by-step guide to help you get started.
1. Choose Your Project Idea
Select a project that interests you and is appropriate for your skill level. Here are some ideas:
To-do list application
Personal blog or portfolio website
Weather app using a public API
Simple game (like Tic-Tac-Toe)
2. Define the Scope
Outline what features you want in your project. Start small and focus on the minimum viable product (MVP) — the simplest version of your idea that is still functional. You can always add more features later!
3. Choose the Right Tools and Technologies
Based on your project, choose the appropriate programming languages, frameworks, and tools:
Web Development: HTML, CSS, JavaScript, React, or Django
Mobile Development: Flutter, React Native, or native languages (Java/Kotlin for Android, Swift for iOS)
Game Development: Unity (C#), Godot (GDScript), or Pygame (Python)
4. Set Up Your Development Environment
Install the necessary software and tools:
Code editor (e.g., Visual Studio Code, Atom, or Sublime Text)
Version control (e.g., Git and GitHub for collaboration and backup)
Frameworks and libraries (install via package managers like npm, pip, or gems)
5. Break Down the Project into Tasks
Divide your project into smaller, manageable tasks. Create a to-do list or use project management tools like Trello or Asana to keep track of your progress.
6. Start Coding!
Begin with the core functionality of your project. Don’t worry about perfection at this stage. Focus on getting your code to work, and remember to:
Write clean, readable code
Test your code frequently
Commit your changes regularly using Git
7. Test and Debug
Once you have a working version, thoroughly test it. Look for bugs and fix any issues you encounter. Testing ensures your software functions correctly and provides a better user experience.
8. Seek Feedback
Share your project with friends, family, or online communities. Feedback can provide valuable insights and suggestions for improvement. Consider platforms like GitHub to showcase your work and get input from other developers.
9. Iterate and Improve
Based on feedback, make improvements and add new features. Software development is an iterative process, so don’t hesitate to refine your project continuously.
10. Document Your Work
Write documentation for your project. Include instructions on how to set it up, use it, and contribute. Good documentation helps others understand your project and can attract potential collaborators.
Conclusion
Building software projects is a fantastic way to learn and grow as a developer. Follow these steps, stay persistent, and enjoy the process. Remember, every project is a learning experience that will enhance your skills and confidence!
3 notes
·
View notes
Note
Mind explaining what C# is for those of us who aren't AI and/or coding nerds?
N.O.V.A.: C# is a programming language, alongside HTML, .NET, and Javascript. It encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.
In layman's terms, it's a programming language.
#danganronpa#sdra2#super danganronpa another 2#sora#nova#a student out of time#DR#Dianthus Memory arc
7 notes
·
View notes
Text
Expanding and cleaning up on a conversion I had with @suntreehq in the comments of this post:
Ruby is fine, I'm just being dramatic. It's not nearly as incomprehensible as I find JavaScript, Perl, or Python. I think it makes some clumsy missteps, and it wouldn't be my first (or even fifth) choice if I were starting a new project, but insofar as I need to use it in my Software Engineering class I can adapt.
There are even things I like about it -- it's just that all of them are better implemented in the languages Ruby borrows them from. I don't want Lisp with Eiffel's semantics, I want Lisp with Lisp's semantics. I don't want Ada with Perl's type system, I want Ada with Ada's type system.
One of these missteps to me is how it (apparently) refuses to adopt popular convention when it comes to the names and purposes of its keywords.
Take yield. In every language I've ever used, yield has been used for one purpose: suspending the current execution frame and returning to something else. In POSIX C, this is done with pthread_yield(), which signals the thread implementation that the current thread isn't doing anything and something else should be scheduled instead. In languages with coroutines, like unstable Rust, the yield keyword is used to pause execution of the current coroutine and optionally return a value (e.g. yield 7; or yield foo.bar;), execution can then be resumed by calling x.resume(), where x is some coroutine. In languages with generators, like Python, the behavior is very similar.
In Ruby, this is backwards. It doesn't behave like a return, it behaves like a call. It's literally just syntax sugar for using the call method of blocks/procs/lambdas. We're not temporarily returning to another execution frame, we're entering a new one! Those are very similar actions, but they're not the same. Why not call it "run" or "enter" or "call" or something else less likely to confuse?
Another annoyance comes in the form of the throw and catch keywords. These are almost universally (in my experience) associated with exception handling, as popularized by Java. Not so in Ruby! For some unfathomable reason, throw is used to mean the same thing as Rust or C2Y's break-label -- i.e. to quickly get out of tightly nested control flow when no more work needs to be done. Ruby does have keywords that behave identically to e.g. Java or C++'s throw and catch, but they're called raise and rescue, respectively.
That's not to say raise and rescue aren't precedented (e.g. Eiffel and Python) but they're less common, and it doesn't change the fact that it's goofy to have both them and throw/catch with such similar but different purposes. It's just going to trip people up! Matsumoto could have picked any keywords he could have possibly wanted, and yet he picked the ones (in my opinion) most likely to confuse.
I have plenty more and deeper grievances with Ruby too (sigils, throws being able to unwind the call stack, object member variables being determined at runtime, OOP in general being IMO a clumsy paradigm, the confusing and non-orthogonal ways it handles object references and allocation, the attr_ pseudo-methods feeling hacky, initialization implying declaration, the existence of "instance_variable_get" totally undermining scope visibility, etc., etc.) but these are I think particularly glaring (if inconsequential).
5 notes
·
View notes
Text
I Love Javascript :)
Daily Blogs 343 - Oct 13th, 12.024
Spent the night configuring ESLint to make my JavaScript code very strict in this new project.
And I love, I love, that you actually need a node_modules folder with 350 dependencies to a fucking linting configuration.
what. the. fuck?
Today's artists & creative things Music: Fuck the Moon Fly Me to the Moon Cover - by Coward
© 2024 Gustavo "Guz" L. de Mello. Licensed under CC BY-SA 4.0
1 note
·
View note
Text
pipe operator in js
Rescuing from my drafts ca march 2023. This is no longer actually true; my company folded last year and I'm back on my gamedev non-sense (bittersweetly!). More details on that soon.
Long time no post. I'm working in elixir these days; I couldn't sleep and so was catching up on modern JavaScript; I watched nerds snipe in the gutters.
what is pipeline?
You read this; you're adjacent to >=1 programmer. It's bash piping, the output from one function goes to the next.
There's a few ways to spell it, from the explicit:
const $0 = foo(input); const $1 = bar($0); const output = baz($1);
Explicit! Legible!
Cumbersome! Weave-y!
To the Hack-style syntax, where the pipe operator creates a variable within its right hand side's scope (sort of like this:
const output = input |> foo($) |> bar($)
Just sugar on top of the above (+ variable lifetime scopes, whatever)
Nobody can agree on the magical "previous expression result" symbol
when the pipe is a series of 1 arg f()s, the ($) extra characters are gross.
To the F#-style syntax, where the calls have to be arity-1 functions:
const output = input \|> foo \|> bar
Handles the happy path 1-arg f() beautifully
requires lambdas or currying and more care for every other case.
F# wins, right?
The community seems to think so.
But it has wrinkles; every method has to be 1-arg, and the hidden closures to enable that have performance impact.
My modest proposal
I wrote this because I didn't want to post on a six-year-and-counting language proposal, but I also had an idle fancy.
To me, the problem isn't a lack of a pipe operator or other functional support.
It's @#_-+&!ing left-hand assignment and community conventions.
You can even see it in the examples, where we have const foo, a bunch of really relevant details, and then wham, we're back to the start for the next line.
What we need is:
A right-hand assignment operator, so that after calculating a variable you can stick it somewhere. Without further thought, I propose =: but I'm sure there could be improvement.
=: assigns to the RHS, and to the special variable it. By default, assigns to _ (discards) -- in addition to it.
A new keyword & local variable "it". "It" is sort of like "this", with special rules about its meaning scoped to the function in which it appears. Typechecking must respect its most recent assignment (how high of a lift is this?!). Lambdas have their own standalone it (so you need to
A community that accepts using non-descriptive variable names & scoped type checkers for this purpose -- for instance, special syntax around right-assigning to $ such that it's type checkable, variable scoped, etc.
The semicolon "operator".
Then a pipe could be written:
input =:; foo(it) =:; bar(it) =: output
Potentially with parens in certain callsites, simplifying it a bit maybe, etc.
Things to improve:
It doesn't look like a pipe.
But is that so bad, when it makes the whole thing so beautifully explicit?
It breaks LHS/RHS naming and conventions (you're assigning?! To the right hand side??!). Doesn't delete foo[bar] do the same? This seems like a very core, very forgivable case to make the code match the language. I do not usually say "x takes the value seven"; I very often do say "store 7 as 'x'".
Real downsides: so many syntax highlighters, code awareness tools etc would need to understand polymorphic horrible "it". Combined with exceptions, the values of it in a catch clause feel pretty scary.
Still, food for thought.
2 notes
·
View notes
Text
Mamiya Review
Man, I don't know many people who know what Mamiya is, and that's a shame. Hell, the only way I know it is because I checked Andrew Hodgson's portfolio the other day and was captured by the art.
People should REALLY check this out. It's like if Nisioisin and Subahibi and the bunker dream scene in Disco Elysium and your lingering yearning for whoever just came up in your mind just now had a love child with the brain the size of thousands of universes or something. Like is that not the most incredible sentence you've ever read? I'm me and I wrote that sentence but it would've made me want to read it.
Pros
Beautiful art
Incredibly curated freeware OST that made me a fan of Ludo for life
Great translation with beautiful and succinct prose
Incredibly well-paced and doesn't waste your time at all
Cons
There is some thematic messaging in the game that leaves a bad taste in my mouth which is obviously subjective but hey this is my review
Will probably leave you hanging and wanting more answers when you're done, maybe even a bit dissatisfied (warning: I am dumb and maybe something flew over my head, a single read is definitely not enough for this one)
Rating: It's good, great even. The part I don't really like about it is subjective and some/most people might be fine with it or understand something about it I don't. I tolerate it because the rest of the game is interesting and everything else about it is very up my alley. If you're interested, make sure you buy the DLC DoomsDayDreams as well. It contains the last chapter of the story.
Spoiler subjective rambling to myself below the cut. Warning: I am dumb and might be too stupid for this game
Steam | VNDB (Part 1)
Why this game is kino
The settings are super interesting and the writing is beautiful. Honestly I would love to fine tooth reread it someday, maybe in Japanese. (Too bad Textractor can't since the engine uses Javascript).
The scope of the game is impressive and how verbose it is about all of those things is an incredible accomplishment. There is something universally accessible about Mamiya's message. You don't need to read a trove of philosophy books to understand what it wants to say. (Though obviously there are references.) You don't need to tolerate great horrors to get to the good parts. The pacing is good and it doesn't waste your time. It doesn't think you're stupid and believes in your ability to figure stuff out. There's a chance I'm jabbing at a kamige a lot of people revere that I also like for the most part but despise at the same time
MAMIYA (meme), Natsume, and the trichiliocosm are all very interesting and well handled themes. I've never really been able to word these feelings myself, so reading a story that builds something about concepts I've felt in my core was very freeing. It kind of makes you feel like an atom, if we could understand how a single atom feels. I think we all have thought about these things at least once. As humans, we all worry and think of the beyond every once in a while.
The effect this story has on you is genuinely beautiful. How can you feel so small and yet so important at the same time? Not only are you a body, you are your soul, you are your mind, and you have an existence before anyone knew what you are. Yet at the same time, we are all part of an infinitely expanding universe that is not only what we ourselves see, but what everyone else generates.
You feel so cherished and yet so insignificant at the same time.
I find MAMIYA so fascinating as well. To verbalize and personify the idea of yearning and admiring a ghost of a person is super interesting. Everyone has felt that for someone else, a longing to be with or to become a beloved. A lot of people grow out of that, but what happens when you don't? What happens when the scars that that yearning left are too deep? Being able to write a story about this concept, give it a mind of its own, and make it metatextually infect actual readers is brilliant.
It's kaleidoscopic in nature. It's a story that is so many things. It wants to be a literal read, it wants to be an abstract read, it wants to be meta, it wants to haunt you, like a ghost, like a veil, for the rest of your life. It's an incredibly unique and unforgettable experience. The only other game to make me feel similarly was Subahibi but I felt way less miserable while going through Mamiya.
That, on top of watching these characters face their weaknesses and ultimately conquer them with their own strength really tickles the Nisioisin fan in me. Like, all of this is incredible stuff. EX is incredible too, even though it hurts so bad. The bittersweet and vague and confusing endings for me leave me wanting more and someone smarter than me to explain what happened help
It leaves you with a love that is yours alone.
If you like the Pink House characters don't read this word vomit
(Vague Door 2 Fata Morgana spoiler mention)
Okay, time to get negative. I dislike almost all of the Pink House characters. I mean, that's definitely by design. All of them are groomers who succumbed to mental weakness and also nobody likes a groomer. It's pretty hard for me to view them just as characters because they did such horrible things to vulnerable children for their own self-satisfaction and weakness. Like brother I'm sorry but I can't just look at characters like this as just characters.
I fucking hate Osamu as a person. He's my least favorite character. To instill MAMIYA is to leave yearning, but damn, him leaving Ryou with his abusive mother and his biological daughter behind is just despicable. He is insufferable to everyone he talks to, he's ugly asf too, I'm gonna kill him, give me ten dollars. If you like him, more power to you, you're better than me, but my brain just can't run the calculations to tolerate him. Just a subjective thing.
Mayuri's relationship with their mother is relatable and I think their struggles with their inner child and self love are very interesting. However, what they do to Minato throughout DDD is despicable and unforgivable to me and it's very hard for me to look at them objectively. Like I totally get that's a me problem.
I mean, I get it though. There are people in my life who've done awful things to me, but I don't want them to die. Rather, I want them to live and be happy, but away from me. I don't wanna know how they're doing either. In this way, I really have nothing against the better ending Minato has with Mayuri, and I found their duel together interesting. It's well done, in my opinion.
Touma is the least offensive of all of them to me and I don't have much to complain about with him, at least from my understanding of his struggles and what he did overall.
Okay he did bad shit too but somehow it didn't leave as bad of a taste in my mouth than the other two. That too, is subjective.
Finally, Samejima is so boring to me. I never cared about Yukimasa from Fatamoru, so more of the same is more shit I don't care about. He's not very interesting to me on a personal level. I just never cared for characters with his narrative.
I guess for me, since ALL of Natsume's friends patch things up with the Pink House quartet it starts to feel very vaguely like, the way to handle your abuser is to understand why they abused you and then accept that it is a cycle and maybe get along with them and cheer them on. Saying that hilariously minimizes every arc but I mean, this was the vibe I got from all four of them just... more or less forgiving their abusers who put them through psychological and sometimes physical hell. It just didn't sit right with me. I think, for a game like this, having at least one character NOT be the "bigger" person and not be amicable, not forgive even after trying, would've made the message come across more clearly. Forgiveness and handling of abuse is messy and a bit of inconsistency among the cast would've garnered a bit more goodwill on my end.
Of course I might be missing the point or blind. I might be dumb as hell who knows. I would love to be enlightened otherwise. It just left a really bad taste in my mouth for a story I overall liked and became the hugest con about it for me.
Character rankings
Upper layer: Nidome > Mamiya > Natsume > Librarian > Senior
Nidome is cute even though he doesn't do much. I liked his design and I felt like this whenever he called Natsume a silly goose. Librarian and Senior are cool I just wish we saw more of them. The upper layer itself is really cool conceptually and I would love a story about it, but who knows if that's gonna happen.
Natsume and Mamiya are givens to like. I honestly can't tell if I like one or the other more.
Natsume's friends: Minato > Haruki > Ryou > Keito
Minato's narrative is relatable and I like them a lot, Haruki I liked more than expected, Ryou is fine, and I like Keito enough, but I feel like as I've gotten older I've had less patience for characters of his archetype. Or don't care about them. Like he's just there to me.
Pink House: Touma > Samejima >> Mayuri >>> Osamu
Touma is the least offensive of them to me (to the point that I would say that I like him), I don't like how Mayuri was handled and Osamu is just trash to me for reasons I spoke of earlier. I don't feel anything for or against Samejima. It's not his fault I don't care for his narrative archetype, but at least he's better than the other two behind him.
Natsume: Spectator/Idea/As a part of MAMIYA > Body
I'm just fucking around at this point
Conclusion
What can I say that I haven't said? It's good and I hope it gets more popularity someday. It certainly deserves it and I think it could be considered a kamige among VN enthusiasts if they gave it a try. People are just going to have to spread the word. I do think that most people would more positive than me even though I feel relatively positive about it, so go crazy and become the salespeople Kenkou Land deserves.
I still feel like I have so many questions and want so many answers for the main endings themselves. EX is both heartbreaking and yet so freeing at the same time, and the main ending is bittersweet and confusing.
It's as if I woke up to news to my dear friend Natsume Souichirou dying myself.
13 notes
·
View notes
Text
JavaScript
Introduction to JavaScript Basics
JavaScript (JS) is one of the core technologies of the web, alongside HTML and CSS. It is a powerful, lightweight, and versatile scripting language that allows developers to create interactive and dynamic content on web pages. Whether you're a beginner or someone brushing up on their knowledge, understanding the basics of JavaScript is essential for modern web development.
What is JavaScript?
JavaScript is a client-side scripting language, meaning it is primarily executed in the user's web browser without needing a server. It's also used as a server-side language through platforms like Node.js. JavaScript enables developers to implement complex features such as real-time updates, interactive forms, and animations.
Key Features of JavaScript
Interactivity: JavaScript adds life to web pages by enabling interactivity, such as buttons, forms, and animations.
Versatility: It works on almost every platform and is compatible with most modern browsers.
Asynchronous Programming: JavaScript handles tasks like fetching data from servers without reloading a web page.
Extensive Libraries and Frameworks: Frameworks like React, Angular, and Vue make it even more powerful.
JavaScript Basics You Should Know
1. Variables
Variables store data that can be used and manipulated later. In JavaScript, there are three ways to declare variables:
var (old way, avoid using in modern JS)
let (block-scoped variable)
const (constant variable that cannot be reassigned)
Example:
javascript
Copy code
let name = "John"; // can be reassigned const age = 25; // cannot be reassigned
2. Data Types
JavaScript supports several data types:
String: Text data (e.g., "Hello, World!")
Number: Numeric values (e.g., 123, 3.14)
Boolean: True or false values (true, false)
Object: Complex data (e.g., { key: "value" })
Array: List of items (e.g., [1, 2, 3])
Undefined: A variable declared but not assigned a value
Null: Intentional absence of value
Example:
javascript
Copy code
let isLoggedIn = true; // Boolean let items = ["Apple", "Banana", "Cherry"]; // Array
3. Functions
Functions are reusable blocks of code that perform a task.
Example:
javascript
Copy code
function greet(name) { return `Hello, ${name}!`; } console.log(greet("Alice")); // Output: Hello, Alice!
4. Control Structures
JavaScript supports conditions and loops to control program flow:
If-Else Statements:
javascript
Copy code
if (age > 18) { console.log("You are an adult."); } else { console.log("You are a minor."); }
Loops:
javascript
Copy code
for (let i = 0; i < 5; i++) { console.log(i); }
5. DOM Manipulation
JavaScript can interact with and modify the Document Object Model (DOM), which represents the structure of a web page.
Example:
javascript
Copy code
document.getElementById("btn").addEventListener("click", () => { alert("Button clicked!"); });
Visit 1
mysite
Conclusion
JavaScript is an essential skill for web developers. By mastering its basics, you can create dynamic and interactive websites that provide an excellent user experience. As you progress, you can explore advanced concepts like asynchronous programming, object-oriented design, and popular JavaScript frameworks. Keep practicing, and you'll unlock the true power of JavaScript!
2 notes
·
View notes