Hello, world.
This is a blog about application development web, desktop & mobile across a range of programming languages incl. JavaScript, C# and more.
These are interesting times for the web. Tag along as I get amazed on what the web can do, how AI is taking over the world, and sympathize my spectacular failures and stupidity.
Explore
- đ Posts â In-depth articles on web development, JavaScript, TypeScript, Vue.js, ASP.NET, and more
- đïž Categories â Browse topics: JavaScript, Vue.js, TypeScript, ASP.NET, and more
- đ Apps â Simple, powerful tools built for real-world use
Stay in touch!: đ€Twitter | đRSS | đGitHub
Use these two quick ways to get a webserver up and running from any folder.
1. Use http-server Install http-server.
npm install http-server -g Navigate to any folder where you need a quick web server and start server.
cd client/dist http-server You can even proxy requests to a back-end server where required.
http-server -P localhost:3333 The above command will start a server at port 8080, and any requests to back-end (e.g /api) is proxied to localhost:3333 if the same is not resolved.
...
Letâs see a few points about when to use a date object, and why use this object vs. a date library?
The simplest and quickest way to get date in Javascript -
console.log(Date.now()); // 1549025852124 Date.now() does not create an object, and is really fast. But, it is also useless if you want to do anything with the date.
Use date objects in numerous ways to format dates, set dates, consider time zones, and for date manipulations.
...
Arguments object enables you to treat function arguments with respect.. and the developers with compassion.
How do you pass arguments to a function?
In its most primitive form:
function getSum(a, b) { return a + b; } This is perfectly ok in an ideal world where Buddha walks the earth.
In the real world populated by Agent Smith and his compadres, one has to be more defensive with function arguments. One of the ways of doing that is by using arguments.
...
When you define a prototype for an object you run the risk of counting that as an object property. Use non-enumerable to avoid doing that.
Consider this -
Object.prototype.colors = () => { return; }; let fruits = ["apple", "orange"]; console.log("fruits length: ", fruits.length); for (fruit in fruits) console.log(fruit); // 0 1 colors Even though the array has two elements, it ends up showing the index 0, 1 and âcolorsâ which is the defined prototype.
This can be avoided in two ways -
...
I love the simplicity, speed and awesomeness of static sites. I also happen to love Vue for its power, simplicity and its feature set that makes development that much easier.
So, what will happen when Vue is combined with static sites?
Awesome Gridsome - thatâs what.
Gridsome describes itself as a Vue-powered site generator. Use Vue to design your site on top of Gridsome framework, and write your content in markdown, and generate complete HTML pages for your content that is complete in all respects.
...
I write quite a bit of Javascript on a day to day basis. But, I have a poor memory and keep forgetting things.
Things like how I should be using a certain function the right way.
This is where web applications like https://jscomplete.com/playground help. But it is not a pleasant experience to have blocks of incomplete code lying around in jscomplete, and keep executing few other parts of the program.
I use the following tools to quickly know how to write a piece of functionality, or quickly test parts of code/components.
...
I have often seen how people talk and write about this being all complex and such. But frankly, I donât understand the pain. All it takes for me to understand is 4-5 iterations of using this in a different functions, classes, modules and so forth, messing up a bit - each time, and trying to do that over & over until I get the right context with the right this.
...
Create your own GraphQL APIs in 15 min flat using Postgres database and a bit of help from PostGraphile. No GraphQL server configuration needed.
No frontend beginner developer ever said - âI want to play around with servers to understand their internals byheart before I venture forth with my beautiful Vue applicationâ.
If you are building on REST APIs, you have public services like JSONPlaceholder. These services provide quick access to much loved sample APIs for to-do, posts, users etc.
...
Javascript is a God-send if you are trying to get things done - quickly. It can run back-end servers, is invaluable for the front-end, and you will never thank enough when you on the way to complete a project that could have taken 10x the time/effort back in the day.
All that comes at a cost. Types seem to be the most blamed for errors, but they could range from anything from bracket mismatches to just âtypingâ issues.
...
Google recaptcha is quite a powerful tool in reducing spam through our contact forms.
Once included in our forms, reCaptcha automatically manages suspicious activity, prompts additional âbot vs. human checksâ, or is completely transparent to the overall flow - depending on who is interacting with the site.
Including reCaptcha in Vue is quite simple.
1. Install vue-recaptcha-v3 Install the NPM package called âvue-recaptcha-v3â. This will enable us to just plug and play recaptcha rather than including the 4-5 lines of code provided by Google.
...