- In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
- This is in contrast to imperative programming where, in addition to a function's arguments, global program state can affect a function's resulting value.
- A function is a process which takes some input, called arguments, and produces some output called a return value.
- A side effect is any application state change that is observable outside the called function other than its return value.
- This is really important for a programming language to support first-class functions which basically means passing functions as arguments to other functions or assigning them to variables.
- That is, the function is passed as an argument to another function, returned as a value from a function, or assigned to variables or data structures.
A Beginner’s Guide to Contributing to Open Source
- For any developer early in their career, contributing to open-source software may seem quite daunting.
- A common misconception about open-source software is that in order to contribute, you need to know how to write code.
- Open-source projects involve a myriad of tasks, including (but not limited to) issue-tracking and labeling, UX design, and documentation- which often gets overlooked, according to this study.
- Picking an open-source project suitable to you can depend on many things, and is ultimately a personal choice; but as a first-time contributor, here are some of the ways you can narrow down which projects might be best to start with.
- As mentioned earlier, one way you can contribute is to update missing or improper documentation you come across while setting up the project.
How to make a Cyberpunk 2077 button with CSS
- Explaining: in the .btn::before we created a box of 24px of width and height, then using position: absolute; to put it in the left bottom of our button, we added a border-top of 2px and a background-color yellow, so the border of the button will not appear behind our boxes.
- the same was applied in .btn::after, we just changed the position to top right and the border to bottom.
- Now using clip-path, we have to modify our .btnclass a bit, to set the borders i have to set a fixed width and height at the parent element: <button> then add a children element with the class .btn__content, with our yellow background, while the parent has black, this is a workaround to simulate a border.
3 ways to time travel in Git to undo destructive mistakes
- What if you could time travel back to a point before you did those destructive changes without deleting anything?
- There is a master branch with 3 files, each added in a separate commit.
- We could manually create a new branch off the old commit and re-add/delete the files that were there, but what a hassle!
- Git reflog shows everywhere our current working HEAD was at, including commits that were removed with destructive commands such as git reset and git rebase.
- Simply pick the commit before our destructive changes, do a hard reset to the gitrevision number (the one with the curly braces), and everything is reset to the way it was before the rebase!
- ORIG_HEAD automatically points to the state before the most recent destructive change, so we can easily undo our most recent rebase or reset with a single command!
- This document is a summary of good programming practices in js in general.
- The trend today is to focus on functional programming, both to develop a frontend or a backend.
- These are some functional programming principles that are useful to know.
- Use camelCase when naming objects, functions, and instances.
- Use PascalCase only when naming constructors or classes.
- Use JSDOC tag to describe a function.
- Different ways of handle errors.
- How to handle functions in a modern way.
- Use named arrow function expressions instead of function declarations.
- Use single quotes '' for strings, don't mix with "".
- Use destructuring when accessing and using multiple properties of an object.
- Use array destructuring.
- Use dot notation when accessing properties.
- MINOR: version when you add functionality in a backwards-compatible manner.
Express-approved middlewares to use in your API
- There are a lot of modules listed in the documentation, so it’s too much to cover all of them, but I’ll talk about a few that I use in most of my Express REST API’s, and when you might need to use them in your project.
- If you want an even more basic setup to serve static files and don’t want to bother with this module, you can use Express’ built-in express.static (more info here).
- But for production-level apps, I much prefer using a reverse proxy like nginx or HAproxy to serve static files.
- Lastly, a note on the compression middleware module: the express middleware page lists this module as an option for gzip compresson, but – much like serving static files – I prefer to do this at the proxy/network layer rather than the app layer (using nginx or HAproxy).
#discussLegacies Never Die: How to Handle Legacy Code
- In fact, it made me a better developer than I was before I started working through the aforementioned codebase, and hopefully your legacy project can teach you something too.
- In a perfect world, every codebase has a robust README that contains concise explanations of how the project works, code comments that explain the exact logic of the original author, and the whole application makes perfect sense.
- Many READMEs don't get updated as projects develop, people forget to write comments, assume that their logic is obvious to a new developer, or they simply run out of time to take care of those things.
- Now that you've had the experience of working in a legacy codebase, you should come away from it with a better sense of what you like and don't like in terms of tools and conventions.
#challengeFighting the Fear of Code Challenges
- By no means am I a pro at solving these, I'm still working my way through 8kyu, 7kyu and 6kyu challenges and my code can use a lot of love (and refactoring!) BUT I have noticed my improvements since I started practising more, and I am proud of how far I've gone.
- If the string has an odd number of characters, add an underscore('_') to the final pair.
- The solutions were definitely more elegant than mine 😅, but I wanted to share what I came up with and explain my thought process (before I refactor it).
- If you're struggling with or avoiding code challenges, take it from someone who used to dread them but now does them for fun 😆 - you can learn to love them with confidence.
- Start easy, be consistent, read other solutions (after you've completed it yourself), and most importantly, pseudo code the hell out of it!
Say Goodbye To Provider Hell With react-component-pack
- That's what people call Provider Hell and I created this tool to make this kind of code more readable.
- DEV is sort of like Medium, but it's open source and 100% focused on developers.
- Now reaching over 3 million visitors per month, it's the fastest growing software development community in the world.
- It's free, devoted to the open web, and will never have popups or a pay wall.
Bootstrap - A Quick Guide to Beginners Avoid Hating it.
- Once you want to trigger a grid use, you must ALWAYS be using a row class and nest the columns as its children.
- One of the most important tool for displaying content in CSS is Flex-box, and it would not be different in Bootstrap.
- Just like the original tool, the most important functionality is to justify or align the content according to the main direction chosen to be the reference.
- Learning and practicing the use of Bootstrap through your projects will not only help you on the page that you are using the tool, but for your entire coding for CSS as well.
- After understanding Bootstrap, it is easier to plan your page and create small classes for yourself that will fit n-components instead of only the components that are exactly the same through your page, resulting in a cleaner and way more compact code, which in my opinion, is quite elegant.