投稿時間:2022-10-24 22:28:46 RSSフィード2022-10-24 22:00 分まとめ(34件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… スクエニ、Apple Watch専用RPG『COSMOS RINGS』を10月28日で配信終了へ https://taisy0.com/2022/10/24/164023.html applewatch 2022-10-24 12:40:19
IT InfoQ Podcast: Principles of Green Software Engineering with Marco Valtas https://www.infoq.com/podcasts/green-software-engineering-principles-2/?utm_campaign=infoq_content&utm_source=infoq&utm_medium=feed&utm_term=global Podcast Principles of Green Software Engineering with Marco ValtasIn this episode Marco Valtas technical lead for cleantech and sustainability at ThoughtWorks North America discusses the Principles of Green Software Engineering The principles help guide software decisions by considering the environmental impact The principles are intended for everyone involved in software and emphasize that sustainability on its own is a reason to justify the work By Marco Valtas 2022-10-24 12:30:00
ROBOT ロボスタ 「超時空要塞マクロス展」終幕!全長70cmマクロス戦艦からロボットへ変形デモは合計4,600回トラブルなし!2023年春に横浜で公開 https://robotstart.info/2022/10/24/macross-tezka-final-day.html 「超時空要塞マクロス展」終幕全長cmマクロス戦艦からロボットへ変形デモは合計回トラブルなし年春に横浜で公開シェアツイートはてブ「超時空要塞マクロス展」の巨大戦艦マクロスからロボットへのトランスフォーメーション変形のデモ展示が年、横浜で開催されることが発表された。 2022-10-24 12:45:10
python Pythonタグが付けられた新着投稿 - Qiita 【numpy】任意のベクトルからの回転角を算出する方法 https://qiita.com/yusuke_s_yusuke/items/95e52c5e5932acd7e056 numpy 2022-10-24 21:37:52
技術ブログ Developers.IO OKR における3種類のゴール https://dev.classmethod.jp/articles/okr-three-types-of-goals/ 達成 2022-10-24 12:05:39
海外TECH MakeUseOf The Best Lego Sets for Marvel and DC Fans https://www.makeuseof.com/best-marvel-dc-lego/ fansno 2022-10-24 12:30:14
海外TECH DEV Community Meme Monday 🎃 https://dev.to/ben/meme-monday-1o5g Meme Monday Welcome to another Meme Monday post Today s cover image comes from last week s thread DEV is an inclusive space Humor in poor taste will be downvoted by mods 2022-10-24 12:40:45
海外TECH DEV Community Building a Notion-like system with Socket.io And React 😍 https://dev.to/novu/building-a-notion-like-system-with-socketio-and-react-1hjg Building a Notion like system with Socket io And React What is this article about We are going to build a knowledge system like Click Up and Notion You will be able to add posts write comments tag other users and show it in their notifications In notion users can see what other users do in real time without refreshing the page This is why we will be using Socket io In the next article I will write about SSE server sent events What is WebSocket WebSocket is a built in Node js module that enables us to create a real time connection between a client and a server allowing them to send data in both ways However WebSocket is low level and doesn t provide the functionalities required to build complex real time applications this is why Socket io exists Socket io is a popular JavaScript library that allows us to create real time bi directional communication between software applications and a Node js server It is optimised to process a large volume of data with minimal delay and provides better functionalities such as fallback to HTTP long polling or automatic reconnection Novu the first open source notification infrastructureJust a quick background about us Novu is the first open source notification infrastructure We basically help to manage all the product notifications It can be In App the bell icon like you have in the Dev Community Websockets Emails SMSs and so on I am having a live event on how to build a Notion like system with NX Nest js Prisma React js React Query Debouncers and many more stuff Feel free to RSVP HERE How to create a real time connection with React amp Socket ioHere we ll set up the project environment for the notion app You ll also learn how to add Socket io to a React and Node js application and connect both development servers for real time communication via Socket io Create the project folder containing two sub folders named client and server mkdir notion platformcd notion platformmkdir client serverNavigate into the client folder via your terminal and create a new React js project cd clientnpx create react app Install Socket io client API and React Router React Router is a JavaScript library that enables us to navigate between pages in a React application npm install socket io client react router domDelete the redundant files such as the logo and the test files from the React app and update the App js file to display Hello World as below function App return lt div gt lt p gt Hello World lt p gt lt div gt export default App Add the Socket io client API to the React app as below import io from socket io client http localhost is where the server host URL const socket io connect http localhost function App return lt div gt lt p gt Hello World lt p gt lt div gt export default App Navigate into the server folder and create a package json file cd server amp npm init yInstall Express js CORS Nodemon and Socket io Server API npm install express cors nodemon socket ioExpress js is a fast minimalist framework that provides several features for building web applications in Node js  CORS is a Node js package that allows communication between different domains Nodemon is a Node js tool that automatically restarts the server after detecting file changes and Socket io allows us to configure a real time connection on the server Create an index js file the entry point to the web server touch index jsSet up a Node js server using Express js The code snippet below returns a JSON object when you visit the http localhost api in your browser index jsconst express require express const app express const PORT app use express urlencoded extended true app use express json app get api req res gt res json message Hello world app listen PORT gt console log Server listening on PORT Import the HTTP and the CORS library to allow data transfer between the client and the server domains const express require express const app express const PORT New importsconst http require http Server app const cors require cors app use express urlencoded extended true app use express json app use cors app get api req res gt res json message Hello world http listen PORT gt console log Server listening on PORT Next add Socket io to the project to create a real time connection Before the app get  block copy the code below New imports const socketIO require socket io http cors origin http localhost Add this before the app get blocksocketIO on connection socket gt console log socket id user just connected socket on disconnect gt socket disconnect console log A user disconnected From the code snippet above the socket io connection  function establishes a connection with the React app then creates a unique ID for each socket and logs the ID to the console whenever a user visits the web page When you refresh or close the web page the socket fires the disconnect event showing that a user has disconnected from the socket Configure Nodemon by adding the start command to the list of scripts in the package json file The code snippet below starts the server using Nodemon In server package json scripts test echo Error no test specified amp amp exit start nodemon index js You can now run the server with Nodemon by using the command below npm start Building the user interfaceHere we ll create the user interface for the notion application to enable users to sign in write posts add comments and tag other users Navigate into the client src folder and create a components folder containing Login js Home js CreatePost js and NotionPost js files cd clientmkdir componentscd componentstouch Login js Home js CreatePost js NotionPost jsUpdate the App js file to render the newly created components on different routes via React Router as below import BrowserRouter Routes Route from react router dom import NotionPost from components NotionPost import CreatePost from components CreatePost import Home from components Home import Login from components Login import io from socket io client const socket io connect http localhost function App return lt BrowserRouter gt lt Routes gt lt Route path element lt Login socket socket gt gt lt Route path dashboard element lt Home socket socket gt gt lt Route path post create element lt CreatePost socket socket gt gt lt Route path post id element lt NotionPost socket socket gt gt lt Routes gt lt BrowserRouter gt export default App Navigate into the src index css file and copy the code below It contains all the CSS required for styling this project import url Grotesk wght amp display swap box sizing border box padding margin font family Space Grotesk sans serif body padding login width min height vh display flex flex direction column align items center justify content center login gt h color abb margin bottom px loginForm width display flex flex direction column loginForm gt input margin px padding px px home navbar width height vh padding px display flex align items center justify content space between border bottom px solid eaeaea home navbar gt h color abb home buttons display flex align items center justify content baseline home createBtn padding px cursor pointer margin right px background color abb border none outline none color fff home createBtn hover createForm button hover background color e home notifyBtn padding px cursor pointer color abb background color fff border px solid c outline none width px posts container width min height vh padding px px post width min height vh background color abb border radius px padding px display flex color eaeaea align items center justify content space between margin bottom px post cta padding px background color fff cursor pointer outline none border none border radius px createPost min height vh width padding px px createPost gt h text align center color abb createForm width min height vh padding px display flex flex direction column createForm title padding px height px margin bottom px text transform capitalize border px solid c createForm content padding px margin bottom px border px solid c createForm button width px padding px height px background color abb color fff outline none border none cursor pointer border radius px notionPost width min height vh background color eaeaea display flex flex direction column padding px px notionPost container width min height vh margin bottom px notionPost author color abb notionPost date opacity font size px notionPost content padding top px line height comments container min height vh border px solid c padding px box shadow px rgba px px px px rgba border radius px comments inputContainer display flex align items center margin px comments input width padding px margin right px comments cta login cta padding px width px cursor pointer outline none border none background color abb color fff comment margin bottom px The Login pageHere the application accepts the username and saves it in the local storage for user identification Copy the code below into the Login component import React useState from react import useNavigate from react router dom const Login gt const username setUsername useState const navigate useNavigate const handleLogin e gt e preventDefault The username console log username localStorage setItem username username navigate dashboard return lt div className login gt lt h gt Sign in to HackNotion lt h gt lt form className loginForm onSubmit handleLogin gt lt label htmlFor username gt Enter your username lt label gt lt input name username id username type text value username required onChange e gt setUsername e target value gt lt button className login cta gt LOG IN lt button gt lt form gt lt div gt export default Login The Home pageCopy the code below into the Home js file It represents the home layout for the application import React from react import useNavigate from react router dom const Home gt const navigate useNavigate const createPostBtn gt navigate post create const readMoreBtn gt navigate post id return lt div className home gt lt nav className home navbar gt lt h gt HackNotion lt h gt lt div className home buttons gt lt button className home createBtn onClick createPostBtn gt CREATE POST lt button gt lt button className home notifyBtn gt NOTIFY lt button gt lt div gt lt nav gt lt div className posts container gt lt div className post gt lt h gt How to create a new Socket io client lt h gt lt button className post cta onClick readMoreBtn gt READ MORE lt button gt lt div gt lt div className post gt lt h gt Creating React Native project with Expo lt h gt lt button className post cta onClick readMoreBtn gt READ MORE lt button gt lt div gt lt div gt lt div gt export default Home The NotionPost pageThis page is dynamic and displays the content of each post via the ID passed into the URL Here users can read the notion post and add comments Copy the code below into the NotionPost js file import React useState from react const NotionPost gt const comment setComment useState const handleAddComment e gt e preventDefault console log comment setComment return lt div className notionPost gt lt div className notionPost container gt lt h gt How to create a new React Native project with Expo lt h gt lt div className notionPost meta gt lt p className notionPost author gt By Nevo David lt p gt lt p className notionPost date gt Created on nd September lt p gt lt div gt lt div className notionPost content gt For this article I will use Puppeteer and ReactJS Puppeteer is a Node js library that automates several browser actions such as form submission lt div gt lt div gt lt div className comments container gt lt h gt Add Comments lt h gt lt form className comments inputContainer onSubmit handleAddComment gt lt textarea placeholder Type in your comments rows className comments input value comment required onChange e gt setComment e target value gt lt button className comments cta gt Add Comment lt button gt lt form gt lt div gt lt p className comment gt lt span style fontWeight bold gt Scopsy Dima lt span gt Nice post fam ️ lt p gt lt div gt lt div gt lt div gt export default NotionPost The CreatePost pageHere we ll create a simple layout that allows users to create posts by adding the title and its content Users will also be able to tag other users using React Tag React Tag is a library that allows us to create tags easily via a single component It provides several features such as autocomplete based on a suggestion list reordering using drag and drop and many more Copy the code below into the CreatePost js file import React useState from react import useNavigate from react router dom const CreatePost gt const navigate useNavigate const postTitle setPostTitle useState const postContent setPostContent useState gets the publish date for the post const currentDate gt const d new Date return d getDate d getMonth d getFullYear logs the post details to the console const addPost e gt e preventDefault console log postTitle postContent username localStorage getItem username timestamp currentDate navigate dashboard return lt gt lt div className createPost gt lt h gt Create a new Post lt h gt lt form className createForm onSubmit addPost gt lt label htmlFor title gt Title lt label gt lt input type text required value postTitle onChange e gt setPostTitle e target value className createForm title gt lt label htmlFor title gt Content lt label gt lt textarea required rows value postContent onChange e gt setPostContent e target value className createForm content gt lt button className createForm button gt ADD POST lt button gt lt form gt lt div gt lt gt export default CreatePost Import React Tags into the CreatePost js file import WithContext as ReactTags from react tag input Update the CreatePost component to contain the code snippet below for creating tags with React Tags The suggestion list for autocompleteconst suggestions Tomer David Nevo map name gt return id name text name const KeyCodes comma enter The comma and enter keys are used to separate each tagsconst delimiters KeyCodes comma KeyCodes enter The React componentconst CreatePost gt An array containing the tags const tags setTags useState deleting tags const handleDelete i gt setTags tags filter tag index gt index i adding new tags const handleAddition tag gt setTags tags tag runs when you click on a tag const handleTagClick index gt console log The tag at index index was clicked return lt div className createPost gt lt form gt below the input fields lt ReactTags tags tags suggestions suggestions delimiters delimiters handleDelete handleDelete handleAddition handleAddition handleTagClick handleTagClick inputFieldPosition bottom autocomplete gt lt button className createForm button gt ADD POST lt button gt lt form gt lt div gt export default CreatePost React Tags also allows us to customize its elements Add the following code to the src index css file You can learn how it s styled here ReactTags tags react tags wrapper ReactTags tagInput width ReactTags selected span ReactTags tag border px solid ddd background abb color white font size px display inline block padding px margin px border radius px min width px ReactTags selected button ReactTags remove color fff margin left px cursor pointer background color orangered padding px border none outline none ReactTags tagInput input ReactTags tagInputField ReactTags tagInput input ReactTags tagInputField focus margin px font size px width padding px height px text transform capitalize border px solid c ReactTags selected span ReactTags tag border px solid ddd background bcfd color white font size px display inline block padding px margin px border radius px ReactTags selected a ReactTags remove color aaa margin left px cursor pointer Styles for suggestions ReactTags suggestions position absolute ReactTags suggestions ul list style type none box shadow em em em rgba background white width px ReactTags suggestions li border bottom px solid ddd padding px px margin ReactTags suggestions li mark text decoration underline background none font weight ReactTags suggestions ul li ReactTags activeSuggestion background fff cursor pointer ReactTags remove border none cursor pointer background none color white Congratulations We ve completed the layout for the notion application Next let s learn how to add all the needed functionalities with the Socket io Node js server Creating new posts with Socket ioIn this section I ll guide you on how to create new posts and display them on the React app with Socket io Update the addPost function within the CreatePost component by sending the newly created post to the server via Socket io Socket io was passed from the App js fileconst CreatePost socket gt other functions const addPost e gt e preventDefault sends all the post details to the server socket emit createPost postTitle postContent username localStorage getItem username timestamp currentDate tags navigate dashboard return lt div className createPost gt lt div gt Create a listener to the event on the server socketIO on connection socket gt console log socket id user just connected socket on createPost data gt data contains all the post details from the React app console log data socket on disconnect gt socket disconnect console log A user disconnected Create an array on the backend server that holds all the posts and add the new post to the list generates a random IDconst fetchID gt Math random toString substring let notionPosts socket on createPost data gt const postTitle postContent username timestamp tags data notionPosts unshift id fetchID title postTitle author username createdAt timestamp content postContent comments We ll use the tags later for sending notifications The notionposts are sent back to the React app via another event socket emit updatePosts notionPosts Add a listener to the notion posts on the React app via the useEffect hook by copying the code below Within Home js fileuseEffect gt socket on updatePosts posts gt console log posts socket Displaying the postsSave the posts into a state and render them as below import React useEffect useState from react import useNavigate from react router dom const Home socket gt const navigate useNavigate const posts setPosts useState Saves the posts into the posts state useEffect gt socket on updatePosts posts gt setPosts posts socket const createPostBtn gt navigate post create Navigates to the NotionPost page to view all the post contents const readMoreBtn postID gt navigate post postID return lt div className home gt lt nav className home navbar gt lt h gt HackNotion lt h gt lt div className home buttons gt lt button className home createBtn onClick createPostBtn gt CREATE POST lt button gt lt button className home notifyBtn gt NOTIFY lt button gt lt div gt lt nav gt lt div className posts container gt posts map post gt lt div className post key post id gt lt h gt post title lt h gt lt button className post cta onClick gt readMoreBtn post id gt READ MORE lt button gt lt div gt lt div gt lt div gt export default Home So far we can only view the posts when we add one Next let s make it possible for us to display the posts when we load the page Create a route on the server that returns the notion posts app get api req res gt res json notionPosts Update the Home js file fetch the notion posts and listen for new posts from the server useEffect gt function fetchPosts fetch http localhost api then res gt res json then data gt setPosts data catch err gt console error err fetchPosts useEffect gt socket on updatePosts posts gt setPosts posts socket Completing the Notion Post componentIn the previous section you learnt how to create and display notion posts to users Here you ll learn how to show the contents of each notion post when you click the Read More button Update the readMoreBtn function within the Home js file as below const readMoreBtn postID gt socket emit findPost postID navigates to the Notionpost routenavigate post postID The code snippet above gets the ID of the selected post and sends a Socket io event containing the post ID to the server before redirecting to the post route Create a listener to the findPost event and return the post details via another Socket io event socket on findPost postID gt Filter the notion post via the post ID let result notionPosts filter post gt post id postID Returns a new event containing the post details socket emit postDetails result Listen to the postDetails event with the NotionPost component and render the post details as below import React useState useEffect from react import useParams from react router dom const NotionPost socket gt gets the Post ID from its URL const id useParams const comment setComment useState const post setPost useState loading state for async request const loading setLoading useState true Gets the post details from the server for display useEffect gt socket on postDetails data gt setPost data setLoading false socket Function for creating new comments const handleAddComment e gt e preventDefault console log newComment comment user localStorage getItem username postID id setComment if loading return lt h gt Loading Please wait lt h gt return lt div className notionPost gt lt div className notionPost container gt lt h gt post title lt h gt lt div className notionPost meta gt lt p className notionPost author gt By post author lt p gt lt p className notionPost date gt Created on post createdAt lt p gt lt div gt lt div className notionPost content gt post content lt div gt lt div gt lt div className comments container gt lt h gt Add Comments lt h gt lt form className comments inputContainer onSubmit handleAddComment gt lt textarea placeholder Type in your comments rows className comments input value comment required onChange e gt setComment e target value gt lt button className comments cta gt Add Comment lt button gt lt form gt lt div gt lt p className comment gt lt span style fontWeight bold gt Scopsy Dima lt span gt Nice post fam ️ lt p gt lt div gt lt div gt lt div gt export default NotionPost The Comments sectionHere I ll guide you through adding comments to each notion post and displaying them in real time Update the handleAddComment function within the NotionPost component to send the new comments details to the server const handleAddComment e gt e preventDefault socket emit newComment comment user localStorage getItem username postID id setComment Create a listener to the event on the server that adds the comment to the list of comments socket on newComment data gt const postID user comment data filters the notion post via its IDlet result notionPosts filter post gt post id postID Adds the comment to the comments list result comments unshift id fetchID user message comment sends the updated details to the React app socket emit postDetails result Update the NotionPost js file to display any existing comments return lt div className notionPost gt lt div className notionPost container gt lt h gt post title lt h gt lt div className notionPost meta gt lt p className notionPost author gt By post author lt p gt lt p className notionPost date gt Created on post createdAt lt p gt lt div gt lt div className notionPost content gt post content lt div gt lt div gt lt div className comments container gt lt h gt Add Comments lt h gt lt form className comments inputContainer onSubmit handleAddComment gt lt textarea placeholder Type in your comments rows className comments input value comment required onChange e gt setComment e target value gt lt button className comments cta gt Add Comment lt button gt lt form gt Displays existing comments to the user lt div gt post comments map item gt lt p className comment key item id gt lt span style fontWeight bold marginRight px gt item user lt span gt item message lt p gt lt div gt lt div gt lt div gt Congratulations You can now create posts and add comments with Socket io For the remaining part of this tutorial I ll guide you through sending notifications to every user you tag in your post using Novu How to add Novu to a React and Node js applicationNovu allows you to add various notification types such as email SMS and in app notifications In this tutorial you will learn how to create a Novu project add Novu to your React and Node js projects and send an in app notification with Novu Install the Novu Node js SDK on the server and the Notification Center in the React app Install on the clientnpm install novu notification centerInstall on the servernpm install novu nodeCreate a Novu project by running the code below A personalised dashboard is available to you Run on the clientnpx novu initYou will need to sign in with Github before creating a Novu project The code snippet below contains the steps you should follow after running npx novu initNow let s setup your account and send your first notificationWhat is your application name Notionging PlatformNow lets setup your environment How would you like to proceed gt Create a free cloud account Recommended Create your account with gt Sign in with GitHubI accept the Terms and Condidtions and have read the Privacy Policy gt Yes️Create your account successfully We ve created a demo web page for you to see novu notifications in action Visit http localhost demo to continueVisit the demo web page http localhost demo copy your subscriber ID from the page and click the Skip Tutorial button We ll be using it later in this tutorial Congratulations You ve successfully added Novu to your React and Node js project Next let s learn how to add in app notifications to the notionging application to notify users when we tag them to a post Adding in app notifications with NovuCreate a Notify js file within the src components folder and copy the code below into the file It contains the elements required for in app notifications from the documentation import React from react import NovuProvider PopoverNotificationCenter NotificationBell from novu notification center import useNavigate from react router dom const Notify gt const navigate useNavigate const onNotificationClick notification gt navigate notification cta data url return lt div gt lt NovuProvider subscriberId lt YOUR SUBSCRIBER ID gt applicationIdentifier lt YOUR APP ID gt gt lt PopoverNotificationCenter onNotificationClick onNotificationClick colorScheme light gt unseenCount gt lt NotificationBell unseenCount unseenCount gt lt PopoverNotificationCenter gt lt NovuProvider gt lt div gt export default Notify The code snippet above adds Novu notification bell icon to the Notify component enabling us to view all the notifications within the application The NovuProvider component requires your Subscriber ID copied earlier from  http localhost demo and your application ID available in the Settings section under API Keys on the Novu Manage Platform Import the Notify component into the Home js file and display the bell icon as below return lt div className home gt lt nav className home navbar gt lt h gt HackNotion lt h gt lt div className home buttons gt lt button className home createBtn onClick createPostBtn gt CREATE POST lt button gt lt Notify gt lt div gt lt nav gt lt div gt Next create the workflow for the application which describes the features you want to add to the application Select Notification from the Development sidebar and create a notification template Click the newly created template then Workflow Editor and ensure the workflow is as below From the image above Novu triggers the Digest engine before sending the in app notification Novu Digest allows us to control how we want to send notifications within the application It collects multiple trigger events and sends them as a single message The image above sends notifications every minutes and it can be effective when you have many users and frequent updates Click the In Appstep from the image above and edit the notification template to contain the content below sender tagged you to a postNovu allows you to add dynamic content or data to the templates using the Handlebars templating engine The data for the sender variable will be inserted into the template as a payload from the request within our app Save the template by clicking Update button and head back to your code editor Sending notifications with NovuSince we want to send notifications to users when we tag them to a post we will have to store each username on the server show them on the suggestion list provided by React Tags and send them notifications via Novu Update the handleLogin function within the Login js file to send the username to the server when they sign in const handleLogin e gt e preventDefault sends the username to the server socket emit addUser username localStorage setItem username username navigate dashboard Listen to the event and store the username in an array on the server let allUsers socket on addUser user gt allUsers push user Also render the list of users via another route on the server app get users req res gt res json allUsers To show the users within the React Tags suggestion list you need to send a request to the API route get the list of users and pass them into the list Update the CreatePost function to fetch the list of users and save them within the local storage before navigating the post create route const createPostBtn gt fetchUser navigate post create const fetchUser gt fetch http localhost users then res gt res json then data gt converts the array to a string const stringData data toString saved the data to local storage localStorage setItem users stringData catch err gt console error err Next retrieve all the users from the local storage and pass them into the suggestion list provided by React Tags for display within the CreatePost component const users setUsers useState useEffect gt function getUsers const storedUsers localStorage getItem users split setUsers storedUsers getUsers const suggestions users map name gt return id name text name To notify each tagged user create a function that loops through the users on the server and sends them a notification via Novu to them Import and initiate Novu on the server const Novu require novu node const novu new Novu lt YOUR API KEY gt Update the createPost listener on the backend to send a notification to all tagged users Loops through the tagged users and sends a notification to each one of themconst sendUsersNotification users sender gt users forEach function user novuNotify user sender sends a notification via Novuconst novuNotify async user sender gt try await novu trigger lt TEMPLATE ID gt to subscriberId user id firstName user text payload sender sender then res gt console log Response gt gt res catch err console error Error gt gt gt gt err socket on createPost data gt const postTitle postContent username timestamp tags data notionPosts unshift id fetchID title postTitle author username createdAt timestamp content postContent comments Calls the function to send a notification to all tagged users sendUsersNotification tags username socket emit updatePosts notionPosts Congratulations We ve completed the code for this project ConclusionSo far you ve learned how to set up Socket io in a React and Node js application send messages between the client and a Node js server add Novu to a React and Node js application and send notifications with Novu This tutorial demonstrates what you can build using Socket io and Novu Feel free to improve on the project by adding an authentication library and saving the blog posts to a database that supports real time communication The complete code for this tutorial is available here Thank you for reading P S I am having a live event on how to build a Notion like system with NX Nest js Prisma React js React Query Debouncers and many more stuff Feel free to RSVP HERE 2022-10-24 12:30:48
海外TECH DEV Community Movement and Visibility Detection with CSS and JS 👀 https://dev.to/ingosteinke/movement-and-visibility-detection-with-css-and-js-53m7 Movement and Visibility Detection with CSS and JS Although CSS has added so many features recently we still have to use JavaScript to detect when an element becomes visible It depends We don t need JavaScript for lazy loading images anymore Scroll linked animations without JavaScript are coming to CSS But we still need IntersectionObserver to animate images when they first become visible We also need IntersectionObserver to check the visual state of a sticky header element As this year s State of CSS survey is open for contributions we can look back on a year of CSS innovation and better cross browser support Extended color space container queries and parent child selectors top wish list items for years are now available in modern web browsers But we still struggle with visibility detection There is no visible and no stuck selector to select elements based on their visibility or sticky state Not so simple Use CasesAn apparently simple use case could be a single page portfolio website We have some pictures some text some links and the contact information A minimalist website focused on images and visuals so we want to add some animation We might also want to shrink or hide the header when scrolling down and make it appear when scrolling up again Can we do this without JavaScript Both use cases are best solved in JavaScript using IntersectionObserver which has a better performance than implementation alternatives based on scroll event handlers Scroll detection can waste performance time and energy blocking our main thread and makes websites feel slow and sluggish IntersectionObserver is a modern API optimized by browser engines But IntersectionObserver is also an API that requires some boilerplate code which is not easy to understand and learn especially as a beginner or as a web developer focused on CSS and web design I will focus on our animation example in this post as there are already a lot of blog posts about sticky headers and their complicated details especially when it comes to compatibility with Safari browsers on iPhones that don t get the latest updates anymore Minimal Movement on Visibility DetectionAs micro animations are trending in web design we want to animate elements when they come into view like when scrolling down a website we could make a teaser text move in a subtle way or make an image enter the viewport Animate css as Animation LibrarySimple animations technically defined as transitions with animation keyframes don t need to be reinvented Animate css animate style is a popular open source CSS animation library that offers a set of predefined animations that can be customized and configured Animating a heading or an image becomes quite easy with animate css as we only need to add two class names animate animated and another animate class to choose an animation effect Adding Visibility DetectionBut without adding a visibility detection the animations don t wait for the user to view the element so they might already have finished when the user scrolls the elements into view A simple visibility detection using IntersectionObserver is not that simple after all We need to initialize an observer object tell it what elements to observe make sure we use the correct container elementadjust the threshold for the visibility triggercode a callback function thatiterates over all triggered element tests the visibility criteria again why see below and adds the animation classes to start the actual animation Code Example and our animated WebsiteYou can the commented code pen and a real world use case below Notable details The code example is written in classic JavaScript lt ES so that we don t need Babel transpilation for older browser support While we might expect the observer only triggering when an intersection happened at the threshold configured in the observer s options object we still need to ensure every intersectingEntry isIntersecting and its intersectionRatiois greater than our observerOptions threshold It seems counter intuitive that we have to check the intersection criteria in our callback I would have expect the IntersectionObserver to return only elements that have changed in the entries array But it seems that initializing an IntersectionObserver causes an intial function call with an array that contains all observable objects whether they are intersecting or not See this StackOverflow answer from for more details We don t initialize the observer until all DOM elements are present loaded so that we don t miss any element that we want to animate document addEventListener DOMContentLoaded Elements data animationclass attributes hold the class name for an animation to be set as an actual class name using classList add by our intersection handler callback function so that each element can have a different class name For the actual portfolio website I added another attribute data animationclassincolumn to be used instead of data animationclass when the animated element is displayed within a column portrait layout like on a small smartphone screen So we can use different animation directions to adapt our animations to alternative screen layouts As an example of an actual website check out out the code on GitHub The actual website is still a work in progress but you can see the animations at Kleiderordnung Berlin de Although our websites might often be complex enough to use custom logic and some JavaScript anyway there are simple situations where we could do without the boilerplate code and just use some CSS to style a website So this is my conclusion Future CSS Visibility Innovation Let s keep our eyes open for upcoming CSS innovation I hope that there will be something like a visible selector so we can handle simple use cases like this without redundant boilerplate JavaScript code so that it becomes even easier to focus on visual web design in the future 2022-10-24 12:03:05
Apple AppleInsider - Frontpage News EU finalizes charger rule forcing USB-C on iPhones in 2024 https://appleinsider.com/articles/22/10/24/eu-finalizes-charger-rule-forcing-usb-c-on-iphones-in-2024?utm_medium=rss EU finalizes charger rule forcing USB C on iPhones in The European Union has given its final approval to the common charger directive a plan that will force Apple and other electronics producers to use USB C by A USB C cable The long debated plan by the EU to introduce a common charger for producers of small electronics and notebooks has passed its final major hurdle On Monday ministers of the EU Council finalized approval of the common charger directive Read more 2022-10-24 12:49:07
Apple AppleInsider - Frontpage News Baseus Magnetic Power Bank review: Kickstand & high capacity make up for size https://appleinsider.com/articles/22/10/24/baseus-magnetic-power-bank-review-kickstand-high-capacity-make-up-for-size?utm_medium=rss Baseus Magnetic Power Bank review Kickstand amp high capacity make up for sizeMagnetic battery packs for iPhone are a dime a dozen but a useful kickstand LED display and large capacity make the Baseus Magnetic Power Bank stand out Baseus Magnetic Power BankIt s not a secret that we re fans of Apple s MagSafe Battery Pack so that makes it all the more difficult to find suitable alternatives However Baseus has a great offering that provides desirable features in a not too big battery Read more 2022-10-24 12:18:22
Apple AppleInsider - Frontpage News An unapologetically plastic iPad isn't going to happen https://appleinsider.com/articles/22/10/24/an-unapologetically-plastic-ipad-isnt-going-to-happen?utm_medium=rss An unapologetically plastic iPad isn x t going to happenA report claims that there was an internal Apple project to create a lower cost iPad that included a keyboard in the box but it was abandoned As Apple s newest iPad launch has had the peculiar effect of making last year s model seem more compelling a new report claims that there could have been a different launch Bloomberg s Mark Gurman says that Apple considered making an iPad that would have been less expensive although he does not give any indication of when this was Read more 2022-10-24 12:19:39
Cisco Cisco Blog Ensuring Security in M&A: An Evolution, Not Revolution https://blogs.cisco.com/security/ensuring-security-in-ma-an-evolution-not-revolution Ensuring Security in M amp A An Evolution Not RevolutionThrough decades of acquisitions Cisco has gained the expertise and experience to make M A seamless and successful by making cybersecurity a priority throughout the integration process 2022-10-24 12:00:49
ニュース @日本経済新聞 電子版 筋トレでぐっすり。睡眠の質を高める上で大切なのが「徐波睡眠」。特に眠りが深い状態を指し、睡眠不足や加齢で減少します。増やすには運動、それもしっかり疲れる程度の筋トレが有効。専門家の解説です。 https://t.co/6wxbjnYc40 https://twitter.com/nikkei/statuses/1584525123805069312 筋トレでぐっすり。 2022-10-24 12:40:03
ニュース @日本経済新聞 電子版 トヨタ、中国BYDと開発の新型EVを発売 現地向けに https://t.co/grN7aglCSM https://twitter.com/nikkei/statuses/1584525019811442688 開発 2022-10-24 12:39:38
ニュース @日本経済新聞 電子版 国内コロナ感染、新たに1万6498人 累計2203万4360人 https://t.co/SmY9RTbreg https://twitter.com/nikkei/statuses/1584523924473143296 累計 2022-10-24 12:35:17
ニュース @日本経済新聞 電子版 中国、「政策不況」脱却に時間 7~9月GDP3.9%増 https://t.co/ohgCmPOWU8 https://twitter.com/nikkei/statuses/1584522518463131648 脱却 2022-10-24 12:29:42
ニュース @日本経済新聞 電子版 ジョンソン氏、不祥事の傷深く 英保守党党首選に不出馬 https://t.co/uj3wTJRdSx https://twitter.com/nikkei/statuses/1584520486813585409 党首 2022-10-24 12:21:37
ニュース @日本経済新聞 電子版 WHOが名称をつけた新変異型は最近無く、ウイルスの進化が止まったということか――。オミクロン株の亜系統やその派生型は200を超え、「第2世代」と呼ばれる変異型は進化を続けています。(無料記事です) #新型コロナ https://t.co/ebJz6jOWYu https://twitter.com/nikkei/statuses/1584520100492636160 2022-10-24 12:20:05
海外ニュース Japan Times latest articles Japan economy minister quits over Unification Church links https://www.japantimes.co.jp/news/2022/10/24/national/japan-economy-minister-set-quit-unification-church-links/ Japan economy minister quits over Unification Church links I ve caused trouble for the administration by not being forthcoming over ties to the religious group Daishiro Yamagiwa told reporters after tendering his resignation 2022-10-24 21:06:06
ニュース BBC News - Home Tory race to be next PM nears deadline with focus on Mordaunt https://www.bbc.co.uk/news/uk-politics-63370359?at_medium=RSS&at_campaign=KARANGA afternoon 2022-10-24 12:34:11
ニュース BBC News - Home Ukraine war: Russian spy chief blames West for nuclear tension https://www.bbc.co.uk/news/world-europe-63373728?at_medium=RSS&at_campaign=KARANGA threats 2022-10-24 12:06:16
ニュース BBC News - Home University staff latest to agree to go on strike https://www.bbc.co.uk/news/education-63351675?at_medium=RSS&at_campaign=KARANGA admin 2022-10-24 12:46:42
ニュース BBC News - Home How many backers do Rishi Sunak and Penny Mordaunt have? https://www.bbc.co.uk/news/uk-politics-63343308?at_medium=RSS&at_campaign=KARANGA minister 2022-10-24 12:27:29
ニュース BBC News - Home US midterm elections: The six races that could decide the US Senate https://www.bbc.co.uk/news/world-us-canada-63291205?at_medium=RSS&at_campaign=KARANGA counts 2022-10-24 12:05:16
ニュース BBC News - Home T20 World Cup: South Africa-Zimbabwe rained off in strange fashion https://www.bbc.co.uk/sport/cricket/63371503?at_medium=RSS&at_campaign=KARANGA conclusion 2022-10-24 12:45:35
ニュース BBC News - Home Owen Farrell: Saracens fly-half one of three withdrawals from England training camp in Jersey https://www.bbc.co.uk/sport/rugby-union/63375888?at_medium=RSS&at_campaign=KARANGA Owen Farrell Saracens fly half one of three withdrawals from England training camp in JerseyOwen Farrell is one of three withdrawals from the England squad for their training camp in Jersey after sustaining a concussion 2022-10-24 12:36:34
ニュース BBC News - Home Women's Super League: Chelsea's Harder leads WSL best goals of weekend https://www.bbc.co.uk/sport/av/football/63372867?at_medium=RSS&at_campaign=KARANGA Women x s Super League Chelsea x s Harder leads WSL best goals of weekendWatch the best goals from the weekend s Women s Super League including Chelsea s Pernille Harder and Manchester City s Khadija Shaw 2022-10-24 12:33:56
北海道 北海道新聞 宗谷12人感染 留萌管内は3人 新型コロナ https://www.hokkaido-np.co.jp/article/750160/ 宗谷管内 2022-10-24 21:12:00
北海道 北海道新聞 小樽雪あかりの路、手宮会場の廃止案浮上 北運河エリアに拡充へ スタッフ不足で https://www.hokkaido-np.co.jp/article/750133/ 小樽雪あかりの路 2022-10-24 21:11:47
北海道 北海道新聞 特殊詐欺指示役か、男4回目逮捕 札幌北署 https://www.hokkaido-np.co.jp/article/750157/ 特殊詐欺 2022-10-24 21:09:58
北海道 北海道新聞 更別村、デジタル活用の住民サービス開始 https://www.hokkaido-np.co.jp/article/750156/ 十勝管内 2022-10-24 21:05:00
IT 週刊アスキー 金融庁からメールが届いたら1日でクレカ凍結!? https://weekly.ascii.jp/elem/000/004/110/4110038/ 本人確認 2022-10-24 21:30:00
海外TECH reddit 月曜日がいちばん飲みたい https://www.reddit.com/r/newsokunomoral/comments/yc9fp5/月曜日がいちばん飲みたい/ ewsokunomorallinkcomments 2022-10-24 12:03:21

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)