IT |
気になる、記になる… |
Nothing、新型ワイヤレスイヤホン「ear (2)」をまもなく発表か ー 新製品を示唆するツイートを投稿 |
https://taisy0.com/2023/03/02/169179.html
|
nothing |
2023-03-02 14:17:22 |
IT |
気になる、記になる… |
「Windows 12」の噂が再び ー 2024年のリリースに向け準備中か |
https://taisy0.com/2023/03/02/169177.html
|
intel |
2023-03-02 14:04:48 |
IT |
ITmedia 総合記事一覧 |
[ITmedia PC USER] アイ・オー・データ機器の「ディスプレイ」「キャプチャカード」「ルーター」がお得! 最大34%引き |
https://www.itmedia.co.jp/pcuser/articles/2303/02/news187.html
|
amazon |
2023-03-02 23:30:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Pythonでお手軽音声合成が可能なgTTSモジュール |
https://qiita.com/milky04/items/e8878c29edaef8980bd7
|
googletexttospeech |
2023-03-02 23:51:27 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Python全く分からん自分のアウトプット その8 |
https://qiita.com/makimakimakimac/items/51285c7247407e22c73b
|
googlecolab |
2023-03-02 23:49:27 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
格安・簡単にCPU, GPUリソースを使えると噂のModalを触ってみる |
https://qiita.com/cacaoMath/items/25b4561ed6335d3ed909
|
cpugpu |
2023-03-02 23:48:41 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
ChatGPT APIをSlackから利用できるようにしてみた |
https://qiita.com/Hiromu25/items/527b49eb3e5541ae7326
|
chatgpt |
2023-03-02 23:37:47 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【AWS】CodePipelineからCodeBuildの環境変数を設定した場合の確認方法 |
https://qiita.com/Ryo-0131/items/d9cf7004567952e69cb9
|
codebuild |
2023-03-02 23:57:52 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
ChatGPT APIをSlackから利用できるようにしてみた |
https://qiita.com/Hiromu25/items/527b49eb3e5541ae7326
|
chatgpt |
2023-03-02 23:37:47 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
ChatGPT APIキー取得までの手順 |
https://qiita.com/kotattsu3/items/b936a65d173a5d39dad0
|
chatgptapi |
2023-03-02 23:56:25 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
【Docker】sed: couldn't open temporary file ./sedxxx: Permission denied対処法 |
https://qiita.com/P-man_Brown/items/93dae7b22df0ac7ca40b
|
sedisexampleexamplesam |
2023-03-02 23:53:49 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Dockerコンテナ上で立てた開発サーバに別端末でアクセスする方法 |
https://qiita.com/progra_dango/items/a115bc038c45879df83f
|
docker |
2023-03-02 23:10:12 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Terraform の azapi を使ってみた |
https://qiita.com/coitate/items/8d01caa319f2fddd48aa
|
httpslearn |
2023-03-02 23:13:48 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【エンジニア必須】Linuxについて。よく使うLinuxコマンド一覧! |
https://qiita.com/ooyama-tetu/items/c1cea2b4c8b97e0768db
|
osopera |
2023-03-02 23:35:55 |
技術ブログ |
Developers.IO |
[備忘録] 同期関数/非同期関数で期待通りの例外がスローされたことをJestで評価する |
https://dev.classmethod.jp/articles/jest-async-func-throw-error-test/
|
delivery |
2023-03-02 14:55:41 |
海外TECH |
MakeUseOf |
How Do Hackers Attack FTP Servers and What Can You Do About It? |
https://www.makeuseof.com/how-hackers-attack-ftp-servers/
|
How Do Hackers Attack FTP Servers and What Can You Do About It Even the process you use to transfer files between devices can be attacked by hackers so data can be stolen Here s what you need to know |
2023-03-02 14:30:17 |
海外TECH |
DEV Community |
How to Build Real-time Weather App Using Vanilla JavaScript and API |
https://dev.to/codewithsadee/how-to-build-real-time-weather-app-using-vanilla-javascript-and-api-4j21
|
How to Build Real time Weather App Using Vanilla JavaScript and APIIn this video I ll show you how to build a real time weather app using vanilla JavaScript and the API This weather app will be responsive and will use the latest weather data from the API If you re looking to build a weather app that is both responsive and powered by the latest weather data then this video is for you By the end of this video you ll have built a responsive weather app that uses the API Source codeFigma UI ️Timestamps Demo Starter file Html Css Project initial css variables and reset Css Material Symbol for Icon Html Css Header Html Css Current Weather Html Css Day Forecast Html Css Today s Highlights Html Css Hourly Forecast Html Css Footer Html Css Loading Html Css Error Css Media queries OpenWeather Signup and API key Javascript All fetch url configuration Javascript All module configuration Javascript Route configuration Javascript Search toggle for mobile device Javascript Search API integration Javascript Current weather API integration Javascript Air pollution API integration with Today s highlight section Javascript Forecast API integration with Hourly and Day forecast section Javascript Error |
2023-03-02 14:26:40 |
海外TECH |
DEV Community |
How I Built an Android Ecommerce App with Medusa |
https://dev.to/medusajs/how-i-built-an-android-ecommerce-app-with-medusa-251b
|
How I Built an Android Ecommerce App with MedusaIn addition to ecommerce websites many ecommerce startups now require mobile applications to enhance the shopping experience for users with features such as push notifications personalization less friction and more Medusa is a set of ecommerce building blocks that gives developers full control over building an ecommerce application Its modules make up a headless backend that any frontend storefront app or admin dashboard can connect to through REST APIs “Headless in this case means that the backend and frontend are separate This article explains how to build an Android ecommerce app with Medusa The code source of the Android client is available on GitHub Here is a preview of what your application should look like at the end of this tutorial PrerequisitesTo follow this guide it s essential to have the following The latest stable version of Node jsYarn but you can use npm or pnpm as alternatives to yarn if you prefer Android Studio Set Up Medusa ServerInstall the Medusa CLI app with the following command yarn global add medusajs medusa cliCreate a new Medusa project medusa new my medusa server seedBy default it will use SQLite database You can configure it to use PostgreSQL database Refer to the documentation for the details Start the server with the commands below cd my medusa servermedusa developYour server runs at port To verify that the server is working properly you can open the URL http localhost store products with your browser You should get the JSON data of products available on your server Set Up the Android Ecommerce ProjectBegin by launching Android Studio and create a new project In the New Project window choose Empty Compose Activity In the following screen choose API Android Tiramisu in the Minimum SDK field You can name your application and your package as you wish In this tutorial the application s name is Medusa Android Application and the package name is com medusajs android medusaandroidapplication Install DependenciesOnce the project is ready edit the application build gradle and add these libraries in the dependencies block dependencies Add the new dependencies here implementation com squareup retrofit retrofit implementation com squareup retrofit converter gson implementation com github skydoves landscapist glide implementation androidx navigation navigation compose Sync the Gradle build file by clicking the Sync Now button The Retrofit library allows you to connect to API with objects while the Glide library facilitates the loading of remote images The navigation connects screens in your Android application Create an XML file named network security config xml inside app res xml and add the following content lt xml version encoding utf gt lt network security config xmlns android gt lt domain config cleartextTrafficPermitted true gt lt domain includeSubdomains true gt localhost lt domain gt lt domain includeSubdomains true gt lt domain gt lt domain config gt lt network security config gt Add this network rule to connect to your localhost in the Android emulator without https The Android emulator recognizes localhost as Edit AndroidManifest xml in app manifests Add these lines inside the manifest node lt xml version encoding utf gt lt manifest xmlns android xmlns tools gt lt Add them here gt lt uses permission android name android permission ACCESS NETWORK STATE gt lt uses permission android name android permission INTERNET gt lt application gt lt application gt lt manifest gt Add this line as an attribute in the application node android networkSecurityConfig xml network security config Connect the Android Project to the Medusa ServerYou have to model the object that represents the API in the Medusa Server Create the package model in app java com medusajs android medusaandroidapplication Inside the package create the Response class and replace the content with the following code package com medusajs android medusaandroidapplication modeldata class ProductsResult val products List lt Product gt data class ProductResult val product Product data class CartResult val cart Cart data class CartRequest val items List lt Item gt data class Product val id String val title String val thumbnail String val variants List lt Variant gt data class Variant val id String val prices List lt Price gt class Price var currency code String var amount Int fun getPrice String return currency code amount data class Item val variant id String val title String val thumbnail String val quantity Int data class Cart val id String val items List lt Item gt data class LineItem val variant id String val quantity Int Each data class represents the JSON data structure you get from or send to the Medusa server You can take a look at the complete API reference of the Medusa server in this store API reference Check if the result of an API call has this structure products id title id title If that is the case then the correspondence data class are these classes data class ProductsResult val products List lt Product gt data class Product val id String val title String You need to access the API endpoints Create the MedusaService interface in app java com medusajs android medusaandroidapplication model and replace the content with the following code package com medusajs android medusaandroidapplication modelimport retrofit Callimport retrofit http interface MedusaService GET store products fun retrieveProducts Call lt ProductsResult gt GET store products id fun getProduct Path id id String Call lt ProductResult gt Headers Content Type application json POST store carts fun createCart Body cart CartRequest Call lt CartResult gt Headers Content Type application json POST store carts id line items fun addProductToCart Path id id String Body lineItem LineItem Call lt CartResult gt GET store carts id fun getCart Path id id String Call lt CartResult gt As you can see there are two annotations One is for the GET request and the other is for the POST request The argument for the annotation is the API endpoint in the Medusa server The argument store products mean http localhost store products The return result represents the result type you will get The Body represents the JSON data you send to the API endpoint The Path represents the parameter of the API endpoint This is only an interface You need to implement it Create the ProductsRetriever class inside the app java com medusajs android medusaandroidapplication model package and replace the content with the following code package com medusajs android medusaandroidapplication modelimport retrofit Callbackimport retrofit Retrofitimport retrofit converter gson GsonConverterFactoryclass ProductsRetriever private val service MedusaService companion object const val BASE URL init val retrofit Retrofit Builder baseUrl BASE URL addConverterFactory GsonConverterFactory create build service retrofit create MedusaService class java fun getProducts callback Callback lt ProductsResult gt val call service retrieveProducts call enqueue callback fun getProduct productId String callback Callback lt ProductResult gt val call service getProduct productId call enqueue callback fun createCart cartId String variantId String callback Callback lt CartResult gt if cartId isNotEmpty val lineItemRequest LineItem variantId val call service addProductToCart cartId lineItemRequest call enqueue callback else val items listOf Item variant id variantId quantity thumbnail null title null val cartRequest CartRequest items val call service createCart cartRequest call enqueue callback fun getCart cartId String callback Callback lt CartResult gt if cartId isNotEmpty val call service getCart cartId call enqueue callback In this class you initialize the retrofit variable with the base URL and the Gson converter to handle JSON Remember that the emulator knows the localhost as Then you create a service with the create method from the retrofit variable with MedusaService You use this service variable within the implemented methods You execute the method defined in the interface resulting in the call object Then you call the enqueue method from this object with the callback argument After the API endpoint is called this callback will be executed Products List ScreenNow that you can connect to API endpoints you can create a UI interface for the products list Create a new file called ProductsList kt in app java com medusajs android medusaandroidapplicationui and replace the content with the following code package com medusajs android medusaandroidapplication uiimport androidx compose foundation import androidx compose foundation layout Columnimport androidx compose foundation layout fillMaxSizeimport androidx compose foundation layout paddingimport androidx compose material Buttonimport androidx compose material Textimport androidx compose runtime Composableimport androidx compose ui Alignmentimport androidx compose ui Modifierimport androidx compose ui graphics Colorimport androidx compose ui layout ContentScaleimport androidx compose ui text font FontWeightimport androidx compose ui unit IntSizeimport androidx compose ui unit dpimport com medusajs android medusaandroidapplication model Productimport com skydoves landscapist ImageOptionsimport com skydoves landscapist glide GlideImage Composablefun ProductsList products List lt Product gt onItemSelected String gt Unit onCartButtonClick gt Unit Column modifier Modifier verticalScroll rememberScrollState fillMaxSize padding dp horizontalAlignment Alignment CenterHorizontally Button onClick onCartButtonClick Text My Cart products forEach product gt Column modifier Modifier padding dp border BorderStroke dp Color Gray clickable onItemSelected product id horizontalAlignment Alignment CenterHorizontally GlideImage imageModel product thumbnail imageOptions ImageOptions contentScale ContentScale Crop requestSize IntSize alignment Alignment Center Text product title fontWeight FontWeight Bold Text product variants prices getPrice In this ProductsList function you create a button to go to the cart screen and a list of products Each card is composed of a remote image a title of the product and the price Each product in Medusa has more than one variant Each variant can have many prices depending on which region For this mobile ecommerce tutorial each product uses the first variant and the first price from the variant The purpose of this decision is to make the tutorial simple But in production you can make a different architecture such as displaying products with their variants Product Info ScreenNow it s time to create a detail page On that page a user can add the product to their shopping cart Create the ProductItem ktfile inside app java com medusajs androidmedusaandroidapplication ui and replace the content with the following code package com medusajs android lt your application name gt uiimport android util Logimport androidx compose foundation layout Columnimport androidx compose foundation layout fillMaxSizeimport androidx compose foundation layout paddingimport androidx compose material Buttonimport androidx compose material Textimport androidx compose runtime Composableimport androidx compose ui Alignmentimport androidx compose ui Modifierimport androidx compose ui unit IntSizeimport androidx compose ui unit dpimport androidx compose ui unit spimport com medusajs android medusaandroidapplication model CartResultimport com medusajs android medusaandroidapplication model Productimport com medusajs android medusaandroidapplication model ProductsRetrieverimport com skydoves landscapist ImageOptionsimport com skydoves landscapist glide GlideImageimport retrofit Callimport retrofit Callbackimport retrofit Response Composablefun ProductItem product Product cartId String onCartChange String gt Unit Column modifier Modifier padding dp fillMaxSize horizontalAlignment Alignment CenterHorizontally GlideImage imageModel product thumbnail imageOptions ImageOptions alignment Alignment Center requestSize IntSize Text product title fontSize sp Text product variants prices getPrice Button onClick val productsRetriever ProductsRetriever val callback object Callback lt CartResult gt override fun onFailure call Call lt CartResult gt t Throwable Log e MainActivity t message override fun onResponse call Call lt CartResult gt response Response lt CartResult gt response isSuccessful let response body let c gt onCartChange c cart id productsRetriever createCart cartId product variants id callback Text Add Item to Cart In the button s callback you create an object of Callback lt CartResult gt with two methods onFailure and onResponse If the API call is successful the onReponse method will be triggered You call onCartChange with the cart id you receive from the server The method saves the cart id to a variable so you can reuse the cart id later If the API call is unsuccessful the onFailure method will be called In this case you just log the error You call the createCart method with the variant id of the product To simplify the tutorial you just send the first variant of the product Then you can only add one piece of the product If you want to add two product units you must press the button twice You also send the cart ID Initially the cart ID will be null in which case the server will create a cart for you However if it is not null you will reuse the existing cart allowing you to add the product To create a cart you call the createCart method with the CartRequest object To add an item to the cart call the addProductToCart method with the LineItem object You can verify the JSON data the Medusa server requires in the API documentation For example to add a line item the expected payload is variant id string quantity metadata Notice the JSON fields variant id and quantity are the same as the fields in the LineItem data class Create a CartYou need to create the ViewModel Create CartViewModel in app java com medusajs android medusaandroidapplication model package com medusajs android medusaandroidapplication modelimport androidx lifecycle ViewModelimport kotlinx coroutines flow MutableStateFlowimport kotlinx coroutines flow StateFlowimport kotlinx coroutines flow asStateFlowdata class CartModel val title String val quantity Int val thumbnail String class CartViewModel ViewModel private val cartState MutableStateFlow emptyList lt CartModel gt val cartState StateFlow lt List lt CartModel gt gt cartState asStateFlow fun setCart cartModels List lt CartModel gt cartState value cartModels The ViewModel has cartState that is a MutableStateFlow holding CartModel Users might want to see what products they have added to their shopping cart You need to create a screen for the cart Create CartCompose in app java com medusajs android lt your application name gt ui and replace its content with the following code package com raywenderlich android medusaandroidapplication uiimport android util Logimport androidx compose foundation layout import androidx compose foundation rememberScrollStateimport androidx compose foundation verticalScrollimport androidx compose material Textimport androidx compose runtime Composableimport androidx compose runtime collectAsStateimport androidx compose runtime getValueimport androidx compose ui Alignmentimport androidx compose ui Modifierimport androidx compose ui unit IntSizeimport androidx compose ui unit dpimport androidx lifecycle viewmodel compose viewModelimport com medusajs android medusaandroidapplication model CartModelimport com medusajs android medusaandroidapplication model CartResultimport com medusajs android medusaandroidapplication model CartViewModelimport com medusajs android medusaandroidapplication model ProductsRetrieverimport com skydoves landscapist ImageOptionsimport com skydoves landscapist glide GlideImageimport retrofit Callimport retrofit Callbackimport retrofit Response Composablefun CartCompose cartId String cartViewModel CartViewModel viewModel val cartStates by cartViewModel cartState collectAsState val callback object Callback lt CartResult gt override fun onFailure call Call lt CartResult gt t Throwable Log e MainActivity t message override fun onResponse call Call lt CartResult gt response Response lt CartResult gt response isSuccessful let response body let c gt val cartModels MutableList lt CartModel gt mutableListOf c cart items forEach item gt val title item title val thumbnail item thumbnail val quantity item quantity val cartModel CartModel title quantity thumbnail cartModels add cartModel cartViewModel setCart cartModels toList val productsRetriever ProductsRetriever productsRetriever getCart cartId callback Column modifier Modifier verticalScroll rememberScrollState fillMaxSize padding dp horizontalAlignment Alignment CenterHorizontally Text My Cart cartStates forEach cartState gt Row modifier Modifier fillMaxWidth padding dp horizontalArrangement Arrangement SpaceBetween GlideImage imageModel cartState thumbnail imageOptions ImageOptions alignment Alignment Center requestSize IntSize Text cartState title Text cartState quantity pcs You use cartViewModel and a ViewModel to hold the products you added to the cart In the onResponse method after a successful API call you set the ViewModel with the cart JSON object from the server You call the getCart method with the cart id argument to get the information about the cart Set up the NavigationAll that s left is to create the navigation that connects the screens Create MainAppCompose inside app java com medusajs ui and replace the content with the following code package com medusajs android medusaandroidapplication uiimport android util Logimport androidx compose runtime import androidx compose runtime saveable rememberSaveableimport androidx navigation NavTypeimport androidx navigation compose NavHostimport androidx navigation compose composableimport androidx navigation compose rememberNavControllerimport androidx navigation navArgumentimport com medusajs android medusaandroidapplication model import retrofit Callimport retrofit Callbackimport retrofit Response Composablefun MainApp products List lt Product gt var cartId by rememberSaveable mutableStateOf val navController rememberNavController var product Product null NavHost navController navController startDestination list composable list ProductsList products onItemSelected product id gt navController navigate item product id onCartButtonClick navController navigate cart composable item product id arguments listOf navArgument product id type NavType StringType it gt val productId it arguments getString product id val callback object Callback lt ProductResult gt override fun onFailure call Call lt ProductResult gt t Throwable Log e MainActivity t message override fun onResponse call Call lt ProductResult gt response Response lt ProductResult gt response isSuccessful let response body let p gt product p product val productsRetriever ProductsRetriever productsRetriever getProduct productId callback product let ProductItem it cartId onCartChange cartId it composable cart CartCompose cartId You created NavHost which is composed of three compose functions or screens You navigate from one screen to another screen with the navigate method of the navController object Finally edit MainActivity that is inside the app java com medusajs android medusaandroidapplication package to call the MainApp that connects the screens Replace the content with the following code package com medusajs android medusaandroidapplicationimport android os Bundleimport android util Logimport androidx activity ComponentActivityimport androidx activity compose setContentimport androidx compose material import com medusajs android medusaandroidapplication model Productimport com medusajs android medusaandroidapplication model ProductsResultimport com medusajs android medusaandroidapplication model ProductsRetrieverimport com medusajs android medusaandroidapplication ui MainAppimport com medusajs android medusaandroidapplication ui theme MedusaAndroidApplicationThemeimport retrofit Callimport retrofit Callbackimport retrofit Responseclass MainActivity ComponentActivity private val productsRetriever ProductsRetriever private var products List lt Product gt emptyList private val callback object Callback lt ProductsResult gt override fun onFailure call Call lt ProductsResult gt t Throwable Log e MainActivity t message override fun onResponse call Call lt ProductsResult gt response Response lt ProductsResult gt response isSuccessful let products response body products emptyList setContentWithProducts fun setContentWithProducts setContent MedusaAndroidApplicationTheme Scaffold topBar TopAppBar title Text text Medusa App MainApp products products override fun onCreate savedInstanceState Bundle super onCreate savedInstanceState productsRetriever getProducts callback Test the ApplicationNow that you have written the code it s time to build the application Make sure the Medusa server is running and run the following command cd my medusa servermedusa developBuild and run the application in the Android emulator But first you need to create a device in Device Manager You will get the screen of the products list Click one of the products then you ll see the product detail page Add some products to your shopping cart in the products list screen click the button to view the cart ConclusionThis tutorial provides an overview of how to build an Android ecommerce application with Medusa This application provides basic functionalities but you can implement more functionalities to enhance it Add a “region switcher for customers region selection Use product variants to provide product options like colors on the details view Implement authentication flow allowing customers to sign up with their email or log in via social media Implement the full checkout experience when customers confirm the payment Integrate payment methods such as Stripe Visit the Medusa store API reference to discover all the possibilities to build your ecommerce application Should you have any issues or questions related to Medusa then feel free to reach out to the Medusa team via Discord |
2023-03-02 14:20:06 |
海外TECH |
DEV Community |
Extracting and using Critical CSS on my Eleventy site |
https://dev.to/starbist/extracting-and-using-critical-css-on-my-eleventy-site-457c
|
Extracting and using Critical CSS on my Eleventy siteThis week I made some enhancements to extracting and implementing Critical CSS on my website that runs on Eleventy To achieve this I created a new package called Acclaimed CSS specializing in Critical CSS extraction So without further ado let s delve into its workings and features About Acclaimed CSSAcclaimed CSS is a user friendly package that simplifies the process of extracting Critical CSS from your website It is a wrapper around Penthouse the original critical path CSS generator and performs two additional functions utilizes the separate file for the configuration and downloads a remote CSS file Using Acclaimed CSSTo begin we must install Acclaimed CSS npm install acclaimedOnce installed we can create a new script to initiate the CSS extraction process I recommend storing this script in the scripts folder and naming it acclaimed js const acclaimed require acclaimed acclaimed critical Lastly we must generate a configuration file called acclaimed json in the project s root directory This file will contain information about the website s pages We can begin by adding the homepage as the first page in this configuration file css out home critical min css url width height keepLargerMediaQueries true strict false blockJSRequests true renderWaitTime timeout forceExclude font face forceInclude pic pic svg pic img dark dark inner not id kss dark img phantomJsOptions ssl protocol any ignore ssl errors true To run the script you should use the node scripts acclaimed js command Alternatively you can use the command acclaimed directly in your terminal but then you have to install Acclaimed globally using the following command npm install g acclaimed Essentially we re instructing the package to visit the webpage use the stylesheet and save the extracted Critical CSS in a file named home critical min css Note You can find all other options on the Penthouse s page Once the Critical CSS is stored and prepared it is time to update the code and include the files correctly Below I ll explain how I accomplished this on my Eleventy and Liquid based website Eleventy and CriticalTo begin we need to add some Liquid filters eleventyConfig addLiquidFilter criticalExists critical gt return fs existsSync assets critical critical critical min css eleventyConfig addLiquidFilter getCritical critical gt return fs readFileSync assets critical critical critical min css Next we ll use these filters in the Liquid template if loadCritical lt link rel preload href css style min css as style gt lt style gt type getCritical lt style gt lt link rel stylesheet href css mentor min css media print onload this media all gt else lt link rel stylesheet href css style min css media all gt endif In the code above I first check whether the Critical CSS file exists using the criticalExists filter If the Critical CSS file exists I use the getCritical filter to retrieve the file s content Additionally I preload the CSS file and load it asynchronously when the document loads entirely If the Critical CSS file does not exist I load the original CSS file as usual The type variable is a custom Eleventy variable I introduced to differentiate between templates on my pages For example my homepage has the type home which means that the criticalExists function checks if the assets critical home critical min css file exists and then the getCritical function fetches its content Since my website has distinct templates I have separate Critical CSS files Once I have included all of these items in my configuration file and generated all Critical CSS files all I need to do is add the correct type variable to each of my templates Eleventy will then serve the Critical CSS throughout the site improving site speed and stability in terms of Cumulative Layout Shift If you re curious about the time it takes to generate different CSS files it only takes about seconds on my MacBook Pro ConclusionWith Acclaimed CSS and some code adjustments there is no reason not to use Critical CSS in your project But before you do check if your website will benefit from using Critical CSS first |
2023-03-02 14:15:00 |
海外TECH |
DEV Community |
What to test in the frontend? |
https://dev.to/woovi/what-to-test-in-the-frontend-50a
|
What to test in the frontend What to test Testing software is not an easy task Even senior developers struggle to make it clear what needs to be tested If you don t know what you are going to test your tests are probably wrong In this article we are going to give you practical examples of what to test in your frontend code this applies to any framework The important part is the concept Integration TestsTests ensure your code behavior is correct It ensures that when given some initial program state you ended up with a given final state Integration tests are the best cost benefit test that you can have Integration tests tests the code like the end user would test it When doing Integration tests you just test public interfaces you don t test internal functions Testing against the DOMYou should not test the implementation but the behaviorYou test like the end userFor instance imagine a login screen with email and password inputs and a submit buttonThe test should input the email and the password then click in the submit button You should assert the API was called with the inputted data Let s see what exactly you should test in your frontend code given some scenarios What to test in a Component validate the component renders without bugs and throwing errorsvalidate the DOM has the elements you do expectvalidate the DOM does not have the elements you do not expectvalidate if the external API requests are being called correctvalidate that Relay GraphQL requests are correct and being called with the right values In ConclusionI hope these practical examples makes your tests making more sense to you This is how Woovi tests and this avoids many regressions and silly bugs Always start with the simplest test case the happy case and keep adding more and more edge cases to squish bugs WooviWoovi is a Startup that enables shoppers to pay as they like To make this possible Woovi provides instant payment solutions for merchants to accept orders If you want to work with us we are hiring Photo by Amélie Mourichon on Unsplash |
2023-03-02 14:05:42 |
Apple |
AppleInsider - Frontpage News |
Daily Deals: iPad Air 5 $499, $400 off 1TB MacBook Air, $300 off iPad Pro & more |
https://appleinsider.com/articles/23/03/02/daily-deals-ipad-air-5-499-400-off-1tb-macbook-air-300-off-ipad-pro-more?utm_medium=rss
|
Daily Deals iPad Air off TB MacBook Air off iPad Pro amp moreOur top finds today include off a inch iPad Pro off an M Pro inch MacBook Pro a eufy security Floodlight Camera for and off a Fitbit Inspire with a free year premium trial Save on a MacBook Pro The AppleInsider crew searches the web for deals at online stores to develop a list of top notch deals on the top tech items including discounts on Apple products TVs accessories and other gadgets We share our top finds in our Daily Deals list to help you save money Read more |
2023-03-02 14:57:29 |
Apple |
AppleInsider - Frontpage News |
Apple looks like it's going to age-restrict AI chat agents |
https://appleinsider.com/articles/23/03/02/apple-looks-like-its-going-to-age-restrict-ai-chat-agents?utm_medium=rss
|
Apple looks like it x s going to age restrict AI chat agentsBased on actions it has taken against a BlueMail update Apple looks like it s going to apply age restrictions on AI chat generators in the App Store Apple blocks BlueMail over content concernsThe tech giant has delayed App Store approval for an update for BlueMail over concerns that it would potentially generate inappropriate content for children Read more |
2023-03-02 14:50:08 |
Apple |
AppleInsider - Frontpage News |
'Prehistoric Planet' season two premieres on Apple TV+ in May |
https://appleinsider.com/articles/23/03/02/prehistoric-planet-season-two-premieres-on-apple-tv-in-may?utm_medium=rss
|
x Prehistoric Planet x season two premieres on Apple TV in MayApple is bringing a second season to its natural history series Prehistoric Planet about dinosaurs on Apple TV featuring new ancient creatures Prehistoric Planet season two is comingNarrated by Sir David Attenborough and featuring an original score by multiple Academy Award winner Hans Zimmer Apple will debut five new episodes in a week long event starting on May Read more |
2023-03-02 14:42:47 |
Apple |
AppleInsider - Frontpage News |
Apple highlights importance of menstrual cycle studies for women's health |
https://appleinsider.com/articles/23/03/02/apple-highlights-importance-of-menstrual-cycle-studies-for-womens-health?utm_medium=rss
|
Apple highlights importance of menstrual cycle studies for women x s healthAhead of International Women s Day on March Apple has shared preliminary findings from its Women s Health Study showing iPhone and Apple Watch research into menstrual cycles Apple says that despite physicians believing periods are a vital health indicator the area is notably under researched It s Apple Women s Health Study is a first of its kind research study that the company is working on with both the Harvard T H Chan School of Public Health and the National Institute of Environmental Health Sciences NIEHS More awareness on menstrual cycle physiology and the impact of irregular periods and PCOS on uterine health is needed Dr Shruthi Mahalingaiah MS Harvard Chan School s assistant professor of Environmental Reproductive and Women s Health and co principal investigator of the Apple Women s Health Study said Read more |
2023-03-02 14:19:58 |
海外TECH |
Engadget |
Biden's cybersecurity plan expands requirements for critical infrastructure |
https://www.engadget.com/bidens-cybersecurity-plan-expands-requirements-for-critical-infrastructure-145019627.html?src=rss
|
Biden x s cybersecurity plan expands requirements for critical infrastructureThe White House is relying on more than an executive order to bolster online security The Biden administration has issued a National Cybersecurity Strategy meant to quot rebalance quot responsibilities toward the larger companies and organizations best equipped to handle threats The initiative will most notably expand the use of minimum security standards for critical infrastructure and establish a common set of regulations to make it easier to comply with that baseline nbsp Accordingly the administration also wants improved public private alliances that can more effectively defend infrastructure The federal government would also modernize its networks and response policies to safeguard against threats Companies may also be on the hook for sloppy behavior The strategy would shift some liability for software and services to developers that ignore recommended cybersecurity practices or ship products with known vulnerabilities The White House hopes to work with Congress and companies on legislation that bars total liability and sets tougher standards for quot specific high risk scenarios quot A safe harbor provision would protect companies that make a sincere effort to develop secure products The plan would also invest more in cybersecurity research and workforces The administration hopes to cut back on quot systemic quot vulnerabilities at the internet s core and to adapt to emerging technologies such as postquantum encryption that is protection against quantum based hacks and digital IDs Some policies will be largely unchanged The government will proactively quot disrupt and dismantle quot threats including international cooperation on fighting ransomware The implementation has already begun the administration says As Cyberscooppoints out though there s no certainty the strategy will work as promised The outline largely delegates responsibilities to individual agencies Congress and in some cases state regulators The result may not be as harmonious as hoped It s also unclear if developers will welcome laws that make them liable for security holes Still the approach sets expectations for how federal officials will tackle digital threats going forward This article originally appeared on Engadget at |
2023-03-02 14:50:19 |
Cisco |
Cisco Blog |
People Behind Purpose at Cisco: Reducing the environmental impacts of our facilities through the EnergyOps Program |
https://feedpress.me/link/23532/16001336/people-behind-purpose-at-cisco-reducing-the-environmental-impacts-of-our-facilities-through-the-energyops-program
|
People Behind Purpose at Cisco Reducing the environmental impacts of our facilities through the EnergyOps ProgramNed Bagno manages Cisco s EnergyOps program which identifies and implements energy efficiency and onsite solar projects across our buildings worldwide |
2023-03-02 14:00:29 |
金融 |
RSS FILE - 日本証券業協会 |
PSJ予測統計値 |
https://www.jsda.or.jp/shiryoshitsu/toukei/psj/psj_toukei.html
|
統計 |
2023-03-02 16:00:00 |
金融 |
RSS FILE - 日本証券業協会 |
株券等貸借取引状況(週間) |
https://www.jsda.or.jp/shiryoshitsu/toukei/kabu-taiw/index.html
|
貸借 |
2023-03-02 15:30:00 |
金融 |
RSS FILE - 日本証券業協会 |
『NISAの日記念イベント 〜資産所得倍増に向けて〜』を開催しました! |
https://www.jsda.or.jp/about/gyouji/230211nisa_event.html
|
資産 |
2023-03-02 14:30:00 |
ニュース |
BBC News - Home |
Marten case police believe baby 'dead for some time' |
https://www.bbc.co.uk/news/uk-64827386?at_medium=RSS&at_campaign=KARANGA
|
gordon |
2023-03-02 14:51:52 |
ニュース |
BBC News - Home |
Meeting to avert junior doctors' strike in England fails |
https://www.bbc.co.uk/news/health-64822366?at_medium=RSS&at_campaign=KARANGA
|
disappointing |
2023-03-02 14:07:14 |
ニュース |
BBC News - Home |
Putin accuses Ukraine of border 'terrorist act' in Russian village |
https://www.bbc.co.uk/news/world-europe-64826028?at_medium=RSS&at_campaign=KARANGA
|
village |
2023-03-02 14:17:17 |
ニュース |
BBC News - Home |
Bitter divisions hamper search for Covid origins |
https://www.bbc.co.uk/news/world-us-canada-64819965?at_medium=RSS&at_campaign=KARANGA
|
agencies |
2023-03-02 14:16:58 |
ニュース |
BBC News - Home |
India v Australia: Hosts bowled out for 163 as visitors on verge of victory |
https://www.bbc.co.uk/sport/cricket/64826777?at_medium=RSS&at_campaign=KARANGA
|
India v Australia Hosts bowled out for as visitors on verge of victoryAustralia need just runs from their second innings to win the third Test against India and secure their place in the World Test Championship final |
2023-03-02 14:22:15 |
ニュース |
BBC News - Home |
Women's Six Nations 2023: Sarah Hunter and Marlie Packer to co-captain England |
https://www.bbc.co.uk/sport/rugby-union/64825808?at_medium=RSS&at_campaign=KARANGA
|
Women x s Six Nations Sarah Hunter and Marlie Packer to co captain EnglandSarah Hunter and Marlie Packer will co captain England as they begin the defence of their Six Nations title this month |
2023-03-02 14:51:24 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
アップル、チャットGPT搭載アプリの承認拒否 - WSJ発 |
https://diamond.jp/articles/-/318826
|
承認拒否 |
2023-03-02 23:10:00 |
コメント
コメントを投稿