js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Compositionを使って、Dialogを作ってみる |
https://qiita.com/jungyeounjae/items/032aa75df0b58e9fd3c7
|
composition |
2023-02-01 22:29:40 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
配列の操作一覧 |
https://qiita.com/BiGzAM/items/6146a1410fda088c1bd5
|
配列 |
2023-02-01 22:28:30 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Ruby10 |
https://qiita.com/yupi/items/3138f7297da6ed958f4f
|
search |
2023-02-01 22:20:10 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS sam pipelineを使うとLambdaをデプロイするCI/CDパイプラインをどうやって作ればいいか分かりそうになる |
https://qiita.com/PG-practice/items/efa5b5ff093e0df66ab8
|
awssam |
2023-02-01 22:37:00 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
配列の操作一覧 |
https://qiita.com/BiGzAM/items/6146a1410fda088c1bd5
|
配列 |
2023-02-01 22:28:30 |
海外TECH |
DEV Community |
Easily deploy your portfolio website with AWS CDK 🚀 |
https://dev.to/kumo/easily-deploy-your-portfolio-website-with-aws-cdk-4l9b
|
Easily deploy your portfolio website with AWS CDK Why follow this tutorial Coding your own portfolio website is a cool introduction to HTML CSS and JavaScript frameworks but there is always a hurdle one I am done how do I deploy my website to the world wide web Other question how do I accomplish it using state of the art technologies and following industry standards To reach this goal I will use the AWS CDK Cloud Development Kit combined with TypeScript to provision a Infrastructure as Code CloudFront application serving my website all around the world Here is a quick look of what the architecture of the app will look like at the end I used this deployment method to deploy the website of sls mentor an open source AWS serverless audit tool I ve been working on these last months I will go step by step explaining everything I did when I achieved this Set up a TypeScript CDK project gt To use the CDK you first have to configure an AWS profile in your CLI The official documentation is very easy to follow if you need help Run these commands in your CLI to setup your CDK project mkdir portfolio amp amp cd portfolionpx cdk init language typescriptcdk init language typescript creates a base TypeScript repository with the following structure portfolio│ gitignore│cdk json│package json│package lock json│ts config json└ーbin│└ーportfolio ts└ーlib│└ーportfolio stack ts└ーnode modulesbin folder contains the different stacks of your project This is where I can set environment variables like the AWS accountId or region lib folder contains the details of my stacks I only have one and it s where I will provision all the necessary resources to deploy my static website cdk json contains the global CDK configuration For this simple use case there will be no need to modify it ️For certificate reasons my CDK application must be deployed to region us east the region is not important even if end users are not part of it as we will see To enable it add the following snippet in bin portfolio tsnew PortfolioStack app PortfolioStack To be added env region us east End To finish the CDK set up run the following command in your CLI cdk bootstrapcdk bootstrap deploys on your AWS account the necessary resources to be able to later deploy your full app Last step add the folder containing my website portfolio └ーfront│└ーsrc│└ーindex html│└ーstyles css Here I use simple HTML CSS but it can be the built files of a React or Angular project too Upload your portfolio on the AWS cloudFirst step to host my portfolio on AWS is to create a container hosting the website s files The easiest solution is to use AWS S and to provision a new bucket containing these files I need to specify the path of the base html file of my website index html It is also one of the rare cases where I need to set publicReadAccess to true because the content is public I want everyone to have access to my portfolio I have another constraint I want the content of this bucket to always contain the latest version of the website s source code CDK offers a construct named BucketDeployment that replaces the content of the bucket with the files found at a specified location front src of my repository at each deployment Added together the stack definition of PortfolioStack in the file lib portfolio stack ts should look like this export class PortfolioStack extends Stack constructor scope Construct id string props StackProps super scope id props Path of the folder containing the built website const FRONT SRC PATH path join dirname front src Create the bucket hosting the website const staticWebsiteHostingBucket new Bucket this StaticWebsiteHostingBucket publicReadAccess true websiteIndexDocument index html Sync the bucket s content with the codebase new BucketDeployment this StaticWebsiteHostingBucketSync sources Source asset FRONT SRC PATH destinationBucket staticWebsiteHostingBucket Now let s run a first deployment with the CLI command cdk deployIt will create the bucket and fill it with the index html file found in my local repository I can see it in my AWS console Access the portfolio from a custom domain nameMy website is now uploaded on the AWS cloud but it would be nicer if anyone could access it using my domain name sls mentor dev If you do not own a domain name AWS Route offers the possibility to buy ones for a fair price In my example dev domains was not available on AWS so I bought it on gandi but you can buy your domain name anywhere you want The important thing is to have access to the name servers after it s yours How to link my S bucket with sls mentor dev It is done in simple steps Create a Route hosted zone that will contain the custom DNS records needed to create this connection Create a HTTPS certificate otherwise my portfolio will only be accessible via http Create a CloudFront distribution allowing to distribute my website all around the world and to use my new HTTPS certificate Create DNS records in my hosted zone to redirect traffic from sls mentor dev and www sls mentor dev to the CloudFront distribution Seems too complicated Using CloudFront allows to use the HTTPS protocol and to deliver my website very quickly around the world thanks to caching Furthermore these steps can be coded in a few lines thanks to the CDK everything left to do is to launch the deployment Let s create the hosted zone by adding this snippet of code under the S bucket definition const DOMAIN NAME sls mentor dev your domain name Create a Route hosted zone to later create DNS records ️Manual action required when the hosted zone was created copy its NS records into your domain s name serversconst hostedZone new HostedZone this DomainHostedZone zoneName DOMAIN NAME Then deploy this change to create the hosted zone cdk deployI have to perform the only manual input required in this tutorial ️very important ️ after deployment Route will create a NS record containing values in my new hosted zone I have to copy them into my DNS s name servers in order to prove my ownership of the domain NS records in the new hosted zone Copied into the domain name servers on gandi On the screenshots I did it using a domain name bought on gandi But it can also be achieved on providers like AWS or any other one Now that I m done with the domain I can create the certificate and set the validation method to fromDns It will automatically communicate with my freshly created hosted zone to validate the authenticity of the certificate ️The certificate MUST be created in the region us east to be compatible with CloudFront that s why I deploy all my resources in this region CloudFront allows for at edge delivery which means that it s not a problem if my visitors are not in the US const WWW DOMAIN NAME www DOMAIN NAME Create the HTTPS certificate ️must be in region us east ️ const httpsCertificate new Certificate this HttpsCertificate domainName DOMAIN NAME subjectAlternativeNames WWW DOMAIN NAME validation CertificateValidation fromDns hostedZone Then time for the CloudFront distribution It is the main node of my architecture It communicates with the certificate I just created to allow HTTPS communication It is the link between the us east bucket and users all around the world thanks to caching there will be minimal latency for end users I specify my bucket as the origin enable a REDIRECT TO HTTPS policy set the domain names with the addition of the www subdomain for optimal compatibility with all browsers and finally reference my new https certificate I also specified an optional responseHeadersPolicy with the ID corresponding to the AWS Managed SecurityHeadersPolicy It s a quick win to improve security in my distribution This best practice is part of sls mentor feel free to check it out Create the CloudFront distribution linked to the website hosting bucket and the HTTPS certificateconst cloudFrontDistribution new Distribution this CloudFrontDistribution defaultBehavior origin new SOrigin staticWebsiteHostingBucket viewerProtocolPolicy ViewerProtocolPolicy REDIRECT TO HTTPS responseHeadersPolicy responseHeadersPolicyId fc f d bed domainNames DOMAIN NAME WWW DOMAIN NAME certificate httpsCertificate Last step redirect requests heading to sls mentor dev and www sls mentor dev to the CloudFront distribution I create DNS records in my hosted zone which have the CloudFront distribution as target These records are A records linking my domain name with the IPv address of the CloudFront distribution Add DNS records to the hosted zone to redirect from the domain name to the CloudFront distributionnew ARecord this CloudFrontRedirect zone hostedZone target RecordTarget fromAlias new CloudFrontTarget cloudFrontDistribution recordName DOMAIN NAME Same from www sub domainnew ARecord this CloudFrontWWWRedirect zone hostedZone target RecordTarget fromAlias new CloudFrontTarget cloudFrontDistribution recordName WWW DOMAIN NAME And I am done Last step is to deploy everything one more time cdk deployBe aware that changes to DNS records can take up to hours to be propagated do not worry if the deployment is successful but your website doesn t work instantlyTime to test it These links should all redirect to the same website always using the https protocol regardless of what I specify |
2023-02-01 13:49:25 |
海外TECH |
DEV Community |
This Week In React #133: Astro, React dying?, Qwikify, CRA, Next.js, Remix, Redux, Storybook, Redwood, Nextra, React-Native... |
https://dev.to/sebastienlorber/this-week-in-react-133-astro-react-dying-qwikify-cra-nextjs-remix-redux-storybook-redwood-nextra-react-native-1a79
|
This Week In React Astro React dying Qwikify CRA Next js Remix Redux Storybook Redwood Nextra React Native Hi everyone This year I would like to make the newsletter a little more digestible Do you have any suggestions for me Do you think I put too many links and some can be deleted Or do you like the exhaustive side My goal is to make this newsletter less time consuming to write so that I can offer you more interesting content like original articles I ll explain it all to you soon If you are into Docusaurus I was recently invited to the Semaphore podcast to talk about it Check out CSS Animation Weekly a great resource for creative CSS developers looking for cool inspiration Subscribe to the official newsletter to receive an email every week Sponsorrefine open source headless React framework for building CRUD appsGet ready to take your skillset to the next level We are thrilled to launch an Open Source refine HackathonYou can win and special swag kits We are excited to collaborate with Strapi Appwrite Meilisearch and Medusa They are sponsoring the refine Hackathon and the winners will get a swag kit from each of them More information about the Hackathon ️ReactAstro Unlock New Possibilities with Hybrid RenderingWith Astro you had to make a global choice for the whole site static SSG or server SSR With Astro it is now possible to choose for each page The article details the internal workings of the Astro build and how it had to evolve to support this new feature They use static analysis to separate static routes from SSR routes Why React isn t dyingDominik explains why React is not about to die React popularized JSX and the concept of component and declarative UI The alternatives take the good parts and try to solve the problems but it will be difficult to challenge it given the size of its ecosystem and its community that only gets stronger with time It would take a big breakthrough innovation Framework agnostic libraries TanStack have a role to play and allow to transfer knowledge from one ecosystem to another Resumable React How To Use React Inside QwikThis article highlights the integration between Qwik and React Qwik is an innovative framework in beta based on resumability rather than hydration It exposes a method qwikify that allows to adapt an existing React component to be used in a Qwik app with several possible hydration modes To reduce the size of the bundle as much as possible it is possible to avoid hydrating the React component and to use the native DOM events directly Replace Create React App recommendation with Vite Dan Abramov answers long comment from Dan Tells the CRA story goal and future with possible options TLDR they don t want to deprecate CRA but don t want to recommend it either depriving yourself of SSG SSR is not a good thing It is possible that the CRA CLI will become a launcher that offers a choice between several popular frameworks Next js Remix CRA AsyncContext React Sebastian Markbåge brings the idea of using TC stage proposal AsyncContext directly as React context Statically typed links are coming to Next js great news for typesafe routing Maybe this will be implemented with their new TypeScript language server plugin instead of a codegen step Coming soon to Next js improved SEO support new metadata export will also be typed with the new TS plugin The Key To Good Component Design Is Selfishness the story a lt Button gt component design over time It goes wrong because of using props to drive internal button content It is worth limiting the responsibility of the button using children and composition Storybook Component Story Format is here the new format comes out of beta and brings interesting improvements boilerplate composition play function while remaining backward compatible How to create one form with many actions in Remix use HTML buttons with name and value props and use TypeScript union types with a schema for each action type Nextra Next js Static Site Generator presents the main new features of Nextra v the static site generator for Next js How Netlify Uses Storybook for Visual Regression TestingThe Curious Case of ReactAndrew Clark on the Creation of Redux this interview that relates the period good teaser of the React documentary that will be released soon Redux offered the most elegant Flux implementation and popularized the concept of reducer Andrew doesn t disavow the project but is happy that React is progressively proposing better alternatives for things like data fetching I Was Wrong About Nested React Components Jack illustrates well why you shouldn t declare one component inside another Scroll Management with Remix and React RouterState of React Ecosystem Jan Redwood official release of v with a new Auth API GraphQL Yoga v GraphQL Armor Remix new dev server preview behind a flag React Router Jotai vDocusaurus TinyBase Redux Toolkit Houston Astro Assitant AI the Astro doc has its own AI to answer your questions Remix seems to want to do the same Lee Robinson new version of my website SponsorExtensible JavaScript libraries for surveys and formsSurveyJS is a set of open source JavaScript form libraries that you can easily integrate into your web app It lets you create and run multiple forms retaining all sensitive data on your servers or have your own self hosted WYSIWYG form builder that non tech users can use directly You can also analyze survey results in custom built dashboards save your forms to PDF or simply convert them to editable PDF files It offers native support for React and Angular rendering and total freedom of choice as to the backend because any server database combination is fully compatible React NativeReact Native RC Android outage postmortem the React Native team looks back at the blocked Android builds of November caused by a Maven release and a dynamic Gradle version dependency Summary of ーReact Native Open Source at Software Mansion nice retrospective of Software Mansion we can say that they have been very active this year Making Your React Native Gestures Feel Natural presents some useful techniques spring velocity resistance to make your animations more natural Using Apache ECharts in React Native introduces a new library that can render Apache EChart components on React Native with either React Native SVG or React Native Skia Run Tests for Key Pieces of Your AppOptimize Your Android Application s Size with Gradle SettingsOpen Native Docs new online doc Proposes to unify native libs to work on several ecosystems React Native NativeScript Flutter Fabric React Native macOS demo WIPExpo Router Quick Notes demoCSS Modules in Expo demo PS user interface using react native react native drawer layout is back React Native react native select proReact Native Radio How can we improve React Native part Meta Responds ️The React Native Show Remotion and Animations in React Native with Jonny Burger JobsJoin the Riverr agency as a frontend developer working on client projects using modern technologies such as React Next js TypeScript A day week job TLDR Senior Software Engineer Remote k k The TLDR newsletter is hiring its first engineer to help build out the hiring platform along with other internal projects Looking for someone with experience shipping side projects or on small teams with experience in Next js and Postgres Supabase Callstack Senior React Native Developer Fully Remote PLN k net on BB monthlyDo you want to work on the world s most used apps Would you like to co create the React Native technology Join the Callstack team of React amp React Native leaders Check our website for more details We are looking forward to seeing your application show us what you ve got Gi Remote React Native JobsWe have several roles open for developers focused on React Native Pay is k plus bonus You must have production experience with RN and be based in the US DM gabe gi to learn more and don t forget to mention This Week in React How to publish an offer OtherTC January meeting great proposals like Immutable Array methods change array by copy or Symbols as WeakMap keys are progressing to stage TypeScript Beta this video by Matt Pocock highlights some of the most interesting features such as decorators and const type parameters Release Notes for Safari Technology Preview CSS nesting declarative shadow DOM Scrollend a new JavaScript event already in Chrome Firefox and polyfills available Turbopack is adding support for webpack loaders What s next for FlutterYou ve Got Options for Removing Event ListenersDeno Built in Node modules Web Development Trends in State of Databases for Serverless amp EdgeImprove your test experience with Playwright Soft Assertions FunSee ya |
2023-02-01 13:36:31 |
海外TECH |
DEV Community |
Introducing Rubberduck 1.0: AI Chat in Visual Studio Code |
https://dev.to/lgrammel/introducing-rubberduck-10-ai-chat-in-visual-studio-code-2519
|
Introducing Rubberduck AI Chat in Visual Studio CodeRubberduck adds a chat interface to Visual Studio Code You can edit code get explanations generate tests and diagnose errors Rubberduck lets you use your own OpenAI API key and call the OpenAI API directly so your code is only seen by you and OpenAI Your API key is stored securely in the Visual Studio Code secret storage The extension is open source and available on GitHub AI ChatChat with Rubberduck about your code and software development topics Rubberduck knows the editor selection at the time of conversation start Edit CodeChange the selected code by instructing Rubberduck to create an edit You can refine the diff by providing instructions in the chat interface Explain CodeAsk Rubberduck to explain the selected code Follow up with more questions in the chat interface Generate TestsWriting test boilerplate is tedious Generate test cases with Rubberduck refine them through chat and get them ready in less than minute Diagnose ErrorsLet Rubberduck identify error causes and suggest fixes to fix compiler and linter errors faster ProjectRubberduck is open source and being developed in public You can find out more here Visual Studio Code Marketplace Rubberduck rubberduck vscodeGithub github com rubberduck ai rubberduck vscodeDiscord discord gg KNHmyZmn |
2023-02-01 13:26:44 |
海外TECH |
DEV Community |
How to build a landing page using Tailwind CSS and no code tools |
https://dev.to/andrewbaisden/how-to-build-a-landing-page-using-tailwind-css-and-no-code-tools-43g3
|
How to build a landing page using Tailwind CSS and no code tools IntroductionA landing page is an important part of any website It s the first thing your visitors will notice so make a good first impression Today in this article we will demonstrate how to create a landing page with Tailwind CSS and no code technologies What is Tailwind CSS Tailwind CSS is a utility first CSS framework for creating bespoke user interfaces quickly It provides a collection of pre designed CSS classes that may be used to easily create complicated designs without the need for unique CSS code Tailwind CSS is a popular choice for front end developers and designers trying to build contemporary flexible websites and applications since it is focused on speed and efficiency What are no code tools Platforms that allow you to construct websites web applications and mobile apps without writing any code are known as no code tools They offer a graphical interface for creating and developing goods allowing you to create complicated functionality by combining pre built blocks templates and drag and drop capabilities These tools are intended for non technical users such as business owners marketers and entrepreneurs who wish to construct their own products without hiring a development team Limey Webflow Bubble Adalo Wix and Squarespace are some prominent no code solutions How to build a website using Tailwind CSSThe first thing we should do is visit the beautiful Tailwind CSS website so that we can see the documentation for using Tailwind CSS It is fairly straightforward to use and the documentation covers everything so learning it is not too challenging Now let s create a basic landing page using Tailwind CSS This code uses HTML for the content and CSS for styling with Tailwind CSS Create a folder on your computer called tailwindcss app and then create an index html file inside of it This is all we need for this very simple Tailwind CSS example Of course it is possible to create even more advanced projects that combine JavaScript frameworks like React with a Tailwind CSS configuration Understanding the basic concepts in this example will make it significantly easier for you to work with more complex Tailwind CSS projects in the future if you are still a beginner Just copy and paste this code into your index html file and then open the file in a web browser to see the landing page lt DOCTYPE html gt lt html gt lt head gt lt meta charset UTF gt lt meta name viewport content width device width initial scale gt lt link href dist tailwind min css rel stylesheet gt lt title gt My landing page lt title gt lt head gt lt body gt lt header class bg indigo p shadow md gt lt h class text xl font bold text white gt My landing page lt h gt lt nav class mt flex gt lt a href class mr font bold text white hover text white gt Home lt a gt lt a href class mr font bold text white hover text white gt About lt a gt lt a href class mr font bold text white hover text white gt Services lt a gt lt a href class font bold text white hover text white gt Contact lt a gt lt nav gt lt header gt lt main class p gt lt h class text xl font bold text gray gt Hello World lt h gt lt p class text gray mb gt Lorem ipsum dolor sit amet consectetur adipiscing elit Aliquam nulla mauris sodales vitae viverra ut tempus ut sem Aenean vel libero pharetra elit feugiat varius Praesent hendrerit venenatis velit id hendrerit Fusce tristique tortor at suscipit condimentum Maecenas eu neque nibh Curabitur interdum non nibh ut pharetra Proin pulvinar pharetra turpis nec ullamcorper neque ultricies a Ut et porta nibh in feugiat risus Morbi nec feugiat felis Proin placerat dui id feugiat lobortis Sed sed libero ligula Phasellus molestie turpis odio a convallis diam euismod a lt p gt lt img src alt Random Image class w mb gt lt p class text gray gt Praesent tincidunt magna vitae tellus dapibus quis ultrices libero ornare Etiam ligula nisi sagittis ut vestibulum non pulvinar ullamcorper ex In tincidunt tortor et dui sagittis quis posuere sem condimentum Integer a fermentum quam vitae gravida lorem Sed bibendum et nunc eget laoreet Nulla eget auctor nulla a convallis tortor Curabitur blandit risus in velit efficitur commodo consequat turpis lobortis Maecenas suscipit sed dolor accumsan bibendum Curabitur laoreet ligula at semper tempus Donec ac nibh nec orci elementum accumsan at id diam Vivamus dui nibh ultricies ut fermentum sit amet dapibus quis dui Donec lacinia leo quis consequat pharetra Ut malesuada lacinia mi eget efficitur lt p gt lt main gt lt body gt lt html gt You should see a landing page with some filler text and an image that automatically changes if you reload the webpage Take a look at the documentation on the Tailwind CSS website and you will see how easy it is to change the style of the landing page The margin padding colours and page layout can all be customised with just a few class changes Honestly the Tailwind CSS documentation is the best place for learning how to use the code With your landing page complete it is time to publish it online There are countless free serverless platforms that allow you to do this like GitHub Pages Vercel and Netlify For other Tailwind CSS installations that use the CLI and frameworks like Next js Laravel and Vite take a look at the Get started with Tailwind CSS page section How to build a website using no code toolsOne of the great things about no code tools is the fact that the bar to entry is very low You don t need to be a programmer to build a website using these tools You can be a designer marketer programmer or even non technical and still learn how to use the tool The no code tool Webflow has a really good example of this on their website which you can see below in this animated gif Step Choosing a no code tool for the landing pageNo code tools are platforms that enable you to create websites and apps without writing any code Choose a tool that you are familiar with and that meets your requirements Personally I chose to use Limey for its ease of use and flexibility Step Brainstorming for the landing page contentIt is critical to plan out your landing page before you begin developing it Determine the goal of your landing page the information it will provide and the features it will have such as graphics text buttons and so on Step Choosing a good templateNo code technologies frequently feature templates that you may use to get started on your landing page Choose a template that is comparable to what you have in mind for your landing page and modify it to meet your requirements Step Integrating the template with Tailwind CSSTailwind CSS is a CSS framework that focuses on functionality and makes it simple to create bespoke designs To include Tailwind CSS into your landing page add the CSS file to your no code tool or link to it in the HTML file s head Step Customising the landing page designCustomise your landing page using the features and tools given by your no code solution Make your landing page aesthetically appealing and user friendly by including photos text buttons and other features Test your landing page before posting it to confirm that everything functions as it should Examine the layout functionality and usability for any flaws Step Deploy the landing page onlineIt s time to publish your landing page after you ve tested it and ensured that everything works properly Make your landing page available on your website or domain Final thoughtsTo summarise creating a landing page with Tailwind CSS and no coding tools is an excellent method to create a professional looking landing page without writing any code You can create a landing page that makes a fantastic first impression on your visitors with a little thought customisation and testing Another great option is to use a platform like Tailmars where most of the work is done and you just need to move code around to get your page looking the way you want |
2023-02-01 13:14:33 |
海外TECH |
DEV Community |
Ultimate guide to master JavaScript's reduce functions |
https://dev.to/costamatheus97/ultimate-guide-to-master-javascripts-reduce-functions-2gb4
|
Ultimate guide to master JavaScript x s reduce functionsThe reduce function in JavaScript is a powerful tool for transforming an array of values into a single value It is a higher order function which means that it takes one or more functions as arguments and returns a new function In this article we will cover the basics of how to use the reduce function and provide some examples to help you get started What is the reduce function and how does it work The reduce function is a method that can be called on an array object in JavaScript It takes two arguments a callback function and an optional initial value The callback function is called on each element in the array starting with the first element and continuing until all elements have been processed The result of each call to the callback function is used as the input to the next call and the final result of the last call is returned by the reduce function The initial value is an optional argument that can be used to set the starting value for the first call to the callback function If an initial value is not provided the first call to the callback function will be made with the first two elements in the array Cool right Now let s see how to actually use it To use the reduce function you must provide a callback function that takes two arguments the accumulator and the current value The accumulator is the result of the previous call to the callback function and the current value is the value of the current element in the array The callback function should return a new value that will be used as the accumulator in the next call to the callback function Here is a simple example of how to use the reduce function to sum the elements in an array const numbers const sum numbers reduce acc curr gt acc curr console log sum In this example the initial value is set to and the callback function adds the current value to the accumulator The result of each call to the callback function is used as the input to the next call and the final result of the last call is returned by the reduce function More examples of the reduce function Finding the maximum value in an array const numbers const max numbers reduce acc curr gt acc gt curr acc curr console log max Counting the frequency of elements in an array const words apple banana apple cherry const frequency words reduce acc curr gt acc curr acc curr return acc console log frequency apple banana cherry Flattening an array of arrays const arrays const flattened arrays reduce acc curr gt acc concat curr console log flattened Transforming an array of objects into a hashmap const users id name Matheus id name Lucas id name Victor const usersHashMap users reduce users currentUser gt const id rest currentUser users id rest return users console log usersHashMap name Matheus name Lucas name Victor BONUS Typescript example of a dynamically created object with type inference from the input to the outputconst usersRouter getUser users get const createApi lt T extends key string string gt router T gt return Object entries router reduce api method endpoint keyof T string gt api method gt fetch endpoint return api as Record lt keyof T gt Promise lt any gt gt const usersApi createApi usersRouter const result usersApi getUser You get autocomplete on the dynamic API methods Final considerationsThe reduce function is a powerful weapon that we can use to transform data with more freedom With it we can achieve the same results as map or filter but with more control to solve a lot of other problems A reminder that reduce is a higher order function not exclusive to the JavaScript language Let me know if you have any questions |
2023-02-01 13:13:28 |
Apple |
AppleInsider - Frontpage News |
Apple's iOS 16.3 update may fix unannounced location privacy bug |
https://appleinsider.com/articles/23/02/01/apples-ios-163-update-may-fix-unannounced-location-privacy-bug?utm_medium=rss
|
Apple x s iOS update may fix unannounced location privacy bugAn alleged security vulnerability that firms to track iPhone users location without permission has seemingly been fixed by Apple Apple released the iOS and iPadOS to the public with its usual list of security fixes this time including a mention of what is labelled CVE Listed under Apple Maps this CVE has not yet been published but the number has been reserved in preparation for publication Apple s release notes say that an app may be able to bypass Privacy preferences and that a logic issue was addressed with improved state management Read more |
2023-02-01 13:42:22 |
海外TECH |
Engadget |
WD_Black SSDs and SanDisk cards are up to 50 percent off at Amazon |
https://www.engadget.com/wd-black-ssd-sandisk-cards-50-percent-off-amazon-130323765.html?src=rss
|
WD Black SSDs and SanDisk cards are up to percent off at AmazonIf you need extra storage for your gaming computers or your gadgets you may want to check out Amazon s latest sale It features several Western Digital Black gaming SSDs in different capacities as well as SanDisk microSDs for up to half off their original price The smallest capacity SSD in the list is WD Black s GB Internal Gaming SSD which you can get for That s percent off its original price of and is an all time low for the product For just a few bucks more at though you can get the GB version of the solid state drive That s only cents more than the lowest price we ve seen it go for on the website and is half the product s original price of nbsp You can also buy a TB WD Black Internal Gaming SSD for or percent less than its retail price of and an all time low for the component Need an even bigger storage space The TB version of the model SN is currently on sale for which is percent off its original price of Both TB and TB SN SSDs can reach speeds of up to MB s and come in an M form factor nbsp But if you want faster SSDs and don t mind paying more you can get the SNX model in TB or TB capacities instead The TB SNX Internal Gaming SSD is currently selling for and while it sold for less in the past that s still percent off retail For more you can double that capacity and get the TB SNX at percent less than usual Both components have speeds that can go up to MB s Also you ll be able to monitor all these SSDs health and switch RGB styles through WD Black s dashboard nbsp In case you re on the lookout for a microSD instead SanDisk s GB Ultra microSDXC memory card is back to its lowest Black Friday price of or percent off retail SanDisk s TB Ultra microSDXC is also available for purchase at a discount right now You can get the card for its all time low price of Both are available at these prices as Lightning Deals which means you can only get them at a discount for a limited time nbsp Shop WD and SanDisk deals at AmazonFollow EngadgetDeals on Twitter and subscribe to the Engadget Deals newsletter for the latest tech deals and buying advice |
2023-02-01 13:03:23 |
ニュース |
BBC News - Home |
PMQs: Starmer and Sunak clash over Raab bullying allegations |
https://www.bbc.co.uk/news/uk-politics-64482998?at_medium=RSS&at_campaign=KARANGA
|
minister |
2023-02-01 13:26:16 |
ニュース |
BBC News - Home |
Tom Brady retires 'for good' after 23 seasons in NFL |
https://www.bbc.co.uk/sport/american-football/64487463?at_medium=RSS&at_campaign=KARANGA
|
brady |
2023-02-01 13:48:28 |
ニュース |
BBC News - Home |
Costa cappuccino has five times more caffeine than Starbucks' |
https://www.bbc.co.uk/news/business-64472214?at_medium=RSS&at_campaign=KARANGA
|
differences |
2023-02-01 13:15:48 |
サブカルネタ |
ラーブロ |
らー麺や えいちつー(西葛西)/えいちつー麺 |
http://ra-blog.net/modules/rssc/single_feed.php?fid=207458
|
東京都江戸川区 |
2023-02-01 13:29:28 |
コメント
コメントを投稿