投稿時間:2021-04-08 20:45:24 RSSフィード2021-04-08 20:00 分まとめ(71件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese 50ms以下の低遅延ゲーミングモード追加。世界最軽量クラス片耳4gのTWSイヤホン「NAKO SE」 https://japanese.engadget.com/nako-se-104519571.html ノイズキャンセリングTWSイヤホンをデザインし、重量でもコストでもを抑えて生産することは決して簡単なことではなく、私たちは昼夜週末を問わず、すべての課題を克服するために稼働してきました。 2021-04-08 10:45:19
TECH Engadget Japanese SONYのフラグシップ「α1」をスナップ機として使ってみた https://japanese.engadget.com/sony-%CE%B1-1-103042480.html 解像度 2021-04-08 10:30:42
TECH Engadget Japanese ポケモンGO、タマゴの「生まれるポケモン」表示に対応。レアリティつき一覧で確認 https://japanese.engadget.com/pokemon-go-not-lootbox-transparency-102054958.html 開始 2021-04-08 10:20:54
TECH Engadget Japanese これがスマホの裏? レノボLegion Phone 2 Pro(仮)はパーツ配置からゲームに特化 https://japanese.engadget.com/lenovo-legion-phone-2-pro-100021214.html legionphonepro 2021-04-08 10:00:21
IT MOONGIFT qutebrowser - Vim風のキーバインドを備えたWebブラウザ http://feedproxy.google.com/~r/moongift/~3/umkYoYDTkrM/ qutebrowserVim風のキーバインドを備えたWebブラウザ開発者であれば、その作業のほとんどがキーボードで行われているはずです。 2021-04-08 21:00:00
python Pythonタグが付けられた新着投稿 - Qiita PythonのデバッグにIcecreamを使ったら重すぎてはまった https://qiita.com/NP_Systems/items/50198a2a889ad53afe9b 2021-04-08 19:45:34
js JavaScriptタグが付けられた新着投稿 - Qiita 【javascript】配列をループして処理成功した要素は削除する https://qiita.com/naoqoo2/items/40aaf6f5ece2ccfaf948 【javascript】配列をループして処理成功した要素は削除するVueなど配列データと見た目が連動データバインディングしているときに、処理成功した要素だけ削除して、失敗した要素は残しておきたい。 2021-04-08 19:57:47
js JavaScriptタグが付けられた新着投稿 - Qiita 【CSS】ドーナツグラフの描き方 https://qiita.com/waco30/items/538307b1738c050c4101 circleaftercsstransformrotatepointdeg以上のときcircleafterにrightというクラスを付与し、円と同じ黄色にします。 2021-04-08 19:36:04
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ERR_CLEARTEXT_NOT_PERMITTED https://teratail.com/questions/332268?rss=all ERRCLEARTEXTNOTPERMITTEDlt前提gtAndroidnbspStudionbspcompileSdkVersionnbspbuildToolsVersionnbspquotquotnbspminSdkVersionnbsptargetSdkVersionnbsplt問題gt題名の通りです。 2021-04-08 19:51:25
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Raspberrypi Zero(WH)でGPIOを使用した音声出力ができない。 https://teratail.com/questions/332267?rss=all RaspberrypiZeroWHでGPIOを使用した音声出力ができない。 2021-04-08 19:50:41
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) wordpressのカスタムフィールドに関して https://teratail.com/questions/332266?rss=all wordpressのカスタムフィールドに関して知識が貧相なので、お手柔らかにお願いします。 2021-04-08 19:48:04
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Javascriptの「○○.○○」みたいな表記について https://teratail.com/questions/332265?rss=all 2021-04-08 19:23:10
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Googleフォームを自作フォーム(HTML)に紐づけしたい https://teratail.com/questions/332264?rss=all Googleフォームを自作フォームHTMLに紐づけしたい前提・実現したいことGoogleフォームを自作フォームHTMLに紐づけしたい発生している問題・エラーメッセージちゃんとaction名とname名を打ち込んだのに、送信ボタンを押しても、送信完了画面に切り替わらない。 2021-04-08 19:18:36
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) AsyncTaskから親フラグメントが同じ、子フラグメントビューへのアクセス方法。 https://teratail.com/questions/332263?rss=all AsyncTaskから親フラグメントが同じ、子フラグメントビューへのアクセス方法。 2021-04-08 19:14:02
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Node.jsアプリのCSSがHerokuデプロイ版で反映されません https://teratail.com/questions/332262?rss=all NodejsアプリのCSSがHerokuデプロイ版で反映されません前提・実現したいこと数ヶ月前からプログラミングの勉強をProgateというサービスを使って、やり始めまして、課題の一環で簡単なレストランレビューのウェブアプリを作っています自分用でビジネスにはしません。 2021-04-08 19:11:23
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Unity WebGLで、二台のwebカメラを認識させたい。 https://teratail.com/questions/332261?rss=all Unityエディター上では、二台認識させることができるのに対して、webGLでビルドしたものをChromeブラウザ上で確認すると一台しかカメラを認識してくれません。 2021-04-08 19:10:26
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) aws CORSポリシーによってブロックされましたと、エラーが出てデータがS3上にアップロードされない。 https://teratail.com/questions/332260?rss=all accessnbsptoampnbs 2021-04-08 19:07:14
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) MYSQL case分で分岐した条件を1カラムする(行列の入れ替え) https://teratail.com/questions/332259?rss=all MYSQLcase分で分岐した条件をカラムする行列の入れ替えテーブルのseqと言うカラム和名に変更して取得し、その項目をつのカラムとして出力したいのですが、caseで分岐すると行として表示されてしまうのですがつのSQLで書きしたなって欲しい値のようになりますでしょうかconcatを使うと値がない場合nullが表示され、複合主キーのためGROUPCONCATでgroupnbspbyされてしまうとつしか表示されなくなってしまいます。 2021-04-08 19:05:54
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) [GAS]最新のウェブアプリURLを取得したい https://teratail.com/questions/332258?rss=all 発行 2021-04-08 19:05:38
Ruby Rubyタグが付けられた新着投稿 - Qiita mimemagic無くてデプロイできない!! https://qiita.com/oogi_kojiro/items/872a57b3c3af4eaf4f80 mimemagic無くてデプロイできない概要本日、ECで自動デプロイの設定を行い、実行しようとしたらこんなエラーがbundlestdoutNothingwrittenbundlestderrYourbundleislockedtomimemagicbutthatversioncouldnotbefoundinanyofthesourceslistedinyourGemfileIfyouhaventchangedsourcesthatmeanstheauthorofmimemagichasremoveditYoullneedtoupdateyourbundletoaversionotherthanmimemagicthathasntbeenremovedinordertoinstall起きていたことRailsの一部であるactivestorageが依存しているmimemagicgemが、ライセンス関連の問題でrubygemsorgから取り下げられました。 2021-04-08 19:34:36
AWS AWSタグが付けられた新着投稿 - Qiita ドメインコントローラーでセッションマネージャーを使う前に必要な設定 https://qiita.com/hiren/items/29bcbcdf4afb661fb8d0 ドメインコントローラーとして使用されているWindowsServerマシンでセッションマネージャーを使用するには、ssmuserアカウントが存在しない場合は手動でアカウントを作成する必要があります。 2021-04-08 19:54:27
Git Gitタグが付けられた新着投稿 - Qiita GitとGitHubの連携をしてみよう https://qiita.com/fulu/items/4eae6debbab45c621764 GitとGitHubの連携をしてみようGitとGitHubの連携をしてみようGitを始めてみよう新しいパソコンを買ったのでGitをインストールしてGitHubと連携したい。 2021-04-08 19:09:59
Ruby Railsタグが付けられた新着投稿 - Qiita mimemagic無くてデプロイできない!! https://qiita.com/oogi_kojiro/items/872a57b3c3af4eaf4f80 mimemagic無くてデプロイできない概要本日、ECで自動デプロイの設定を行い、実行しようとしたらこんなエラーがbundlestdoutNothingwrittenbundlestderrYourbundleislockedtomimemagicbutthatversioncouldnotbefoundinanyofthesourceslistedinyourGemfileIfyouhaventchangedsourcesthatmeanstheauthorofmimemagichasremoveditYoullneedtoupdateyourbundletoaversionotherthanmimemagicthathasntbeenremovedinordertoinstall起きていたことRailsの一部であるactivestorageが依存しているmimemagicgemが、ライセンス関連の問題でrubygemsorgから取り下げられました。 2021-04-08 19:34:36
技術ブログ Developers.IO クラスメソッド新卒入社2年目の業務・アウトプットをご紹介します https://dev.classmethod.jp/articles/work-in-the-second-year-after-graduation/ 記事 2021-04-08 10:15:17
海外TECH DEV Community How to add Dialog Component to Vuejs App https://dev.to/loizenai/how-to-add-dialog-component-to-vuejs-app-49i9 How to add Dialog Component to Vuejs AppIn this tutorial grokonez com shows you way to add a Dialog Component to Vuejs App DemoCreate Dialog componentIn src folder create components then add GkzDialog vue file src components GkzDialog vue lt template gt lt div class modal v show show gt lt div class modal dialog gt lt div class modal content gt lt div class modal header gt lt h class modal title mx auto gt title lt h gt lt div gt lt div class modal body v if announcement gt lt p gt announcement lt p gt lt div gt lt div class modal footer gt lt button click dismiss type button class btn btn primary mx auto gt OK lt button gt lt div gt lt div gt lt div gt lt div gt lt template gt lt script gt export default props show type Boolean required true title type String required true announcement type String required false methods dismiss this emit close created const escHandler e gt if e key Escape amp amp this show this dismiss document addEventListener keydown escHandler this once hook destroyed gt document removeEventListener keydown escHandler lt script gt lt style gt modal background aaa display flex lt style gt lt script gt lt style gt modal background aaa display flex lt style gt More at 2021-04-08 10:26:33
海外TECH DEV Community Prioritize tasks like a BOSS with the Eisenhower method 😎 https://dev.to/technoglot/prioritize-tasks-like-a-boss-with-the-eisenhower-method-5a5e Prioritize tasks like a BOSS with the Eisenhower method Photo by Carl Heyerdahl on UnsplashHello fam How s life treating you I truly hope you are doing well If not here s a small dose of inspiration for you If you liked my previous blog you may enjoy this one too What is the Eisenhower method really For those unfamiliar the Eisenhower method also referred to as the Eisenhower matrix or Eisenhower box is a technique that allows you to organize and prioritize your tasks A little background history If you are curious to know where this method got its name from you are in the right place If you don t care about its history you can continue to the next section This method was initially ideated by the th President of the United States Dwight D Eisenhower He was the President of the US from to Before assuming the role of President Eisenhower served as a general in the US Army Supreme Commander of the Allied Forces during World War II andfirst Supreme Commander of NATO As you can see Eisenhower was a man involved in various important roles These roles constantly required him to make important and swift decisions And for that reason he decided to put together a method for prioritizing tasks This method is still used til this day Now you may be thinking Cool thanks for the unsolicited history class But how does this work And why should I a mere mortal even care Good thing you asked Let us move on to the next point How does this Eisenhower method work The Eisenhower matrix is made up of four quadrants as illustrated below Image SourceFirst of all note that these quadrants are formed by analyzing the importance and the urgency of the task at hand So on the y axis the importance of the task is measured and categorized as important or not important Conversely the x axis is concerned with urgency and categorizes tasks by either urgent or not urgent Easy right Let us take a closer look at each quadrant shall we Quadrant ️⃣ Urgent amp ImportantThis first quadrant is where your most urgent and important tasks will live Examples of such tasks are Putting out a fireResolving a conflict within your teamFixing a critical bug in productionReplying to that mail from your boss or team leadIdeally you should start your day by tackling tasks in this quadrant Quadrant ️⃣ Not Urgent but ImportantThe second quadrant is where your non urgent yet important tasks live Examples of such tasks are Checking your other emailsExercisingBooking your worked hours Quadrant ️⃣ Urgent but Not ImportantThe third quadrant of the Eisenhower matrix is where urgent yet unimportant tasks will be located These tasks should be delegated to others whenever possible After all these are the tasks that you risk putting off time and time again You have been warned Quadrant ️⃣ Neither Urgent Nor ImportantThe last and fourth quadrant of the Eisenhower matrix is where your non urgent and unimportant tasks reside Tasks that fall under this quadrant are typically eliminated since they contribute little or nothing to your productivity or the goal you are pursuing However you could use this quadrant to add tasks that help you catch a break from work You could put recreational activities here or small rewards that you want to give yourself for your hard work Tip I ll drop a tip to help you decide in which quadrant to place your tasks Ready Now ask yourself Is the task at hand urgent true or false Is the task at hand important true of false let urgent yourAnswer let important yourAnswer if urgent amp amp important console log Quadrant DO IT NOW else if urgent amp amp important console log Quadrant SCHEDULE IT else if urgent amp amp important console log Quadrant DELEGATE IT else console log Quadrant DROP IT DO LATER Final words ‍ ️And there you have it Sounds familiar No Okay That should be about everything you need to know about the Eisenhower method matrix box Let me know what you think in the comments below Have you tried it before Will you try it Why or why not Go on and crunch these tasks See you next time Happy hacking ‍‍SourcesGood ol WikipediaFrom the Paymoapp blogDownload the Eisenhower Canvas in PDF format 2021-04-08 10:09:39
海外TECH DEV Community How does AWS CodeBuild & AWS CodePipeline Compare? https://dev.to/aws-builders/how-does-aws-codebuild-aws-codepipeline-compare-3e08 How does AWS CodeBuild amp AWS CodePipeline Compare Introduction What is AWS CodeBuild What is AWS CodePipeline AWS CodeBuild is a fully managed build service in the cloud AWS CodeBuild compiles the source code runs unit tests and produces artifacts that are ready to deploy CodeBuild eliminates the need to provision manage and scale own build servers It provides prepackaged build environments for popular programming languages and build tools such as Apache Maven Gradle and more You can also customize build environments in CodeBuild to use your own build tools CodeBuild scales automatically to meet peak build requestsAWS CodePipeline on the other hand is a fully managed continuous delivery service that helps to automate the release pipelines for fast and reliable application and infrastructure updates CodePipeline automates the build test and deploy phases of the release process every time there is a code change based on the release model you define This enables a rapid and reliable delivery of features and updates AWS CodePipeline can easily integrate with third party services such as GitHub or any other custom plugin My Background I am Cloud DevOps amp Big Data Enthusiast x AWS Certified x OCI Certified x Azure Certified What are the differences The main difference between the two is AWS CodeBuild can be classified as a tool in the Continuous Integration category while AWS CodePipeline is grouped under Continuous Deployment What is Continuous Integration Continuous integration is a software development method where members of the team can integrate their work at least once a day In this method every integration is checked by an automated build to search the error In continuous integration after a code commit the software is built and tested immediately In a large project with many developers commits are made many times during a day With each commit code is built and tested If the test is passed build is tested for Deployment If the Deployment is a success the code is pushed to production This commit build test and deploy is a continuous process and hence the name continuous integration deployment What is Continuous Delivery Continuous delivery is a software engineering method in which a team develops software products in a short cycle It ensures that software can be easily released at any time The main aim of continuous delivery is to build test and release software with good speed and frequency It helps you to reduce the cost time and risk of delivering changes by allowing for frequent updates in production What is Continuous DeploymentContinuous deployment is a software engineering process in which product functionalities are delivered using automatic deployment It helps testers to validate whether the codebase changes are correct and stable or not The team can achieve continuous deployment by relying on infrastructure that automates different testing steps Once each integration meets this release criteria the application is updated with a new code How do you run AWS CodeBuild and AWS CodePipeline You can use the AWS CodeBuild or AWS CodePipeline console to run CodeBuild You can also automate the running of CodeBuild by using the AWS Command Line Interface AWS CLI or the AWS SDKs Source stackshare ioYou can then add CodeBuild as a build or test action to the build or test stage of a pipeline in AWS CodePipeline AWS CodePipeline is a continuous delivery service that you can use to model visualize and automate the steps required to release your code This includes building your code A pipeline is a workflow construct that describes how code changes go through a release process See the illustration below Source stackshare io What are some of the tools that integrate with AWS CodeBuild and AWS CodePipeline Some of the tools that integrate with AWS CodeBuild include GitHub GitHub Enterprise Jenkins Bitbucket AWS CodeCommit AWS CodeFormation AWS Elastic Beanstalk and Amazon S On the other hand some of the tools that integrate with AWS CodePipeline include GitHub AWS Elastic Beanstalk Amazon EC Amazon S Jenkins Cloudbees and Runscope What are some alternatives to AWS CodeBuild and AWS CodePipeline JenkinsJenkins is the leading open source continuous integration server Built with Java it provides over plugins to support building and testing virtually any project AWS CodeDeployAWS CodeDeploy is a service that automates code deployments to Amazon EC instances AWS CodeDeploy makes it easier to rapidly release new features helps you avoid downtime during deployment and handles the complexity of updating your applications AWS CodeStarAWS CodeStar provides a unified user interface enabling you to easily manage your software development activities in one place Apache MavenMaven allows a project to build using its project object model POM and a set of plugins that are shared by all projects using Maven providing a uniform build system GitLab CIGitLab offers a continuous integration service If you add a gitlab ci yml file to the root directory of your repository and configure your GitLab project to use a Runner then each merge request or push triggers your CI pipeline ConclusionEvery project has its own requirements and every CI CD is unique But when you have such great and easy to use tools available for you you might as well want to make smarter use of them AWS CodeBuild and AWS CodePipeline protects your secrets automates jobs reduces chances of error and saves time and effort In a poll by Stackshare in its community “Pay per minute is the primary reason why developers consider AWS CodeBuild over the competitors whereas “Simple to set up was stated as the key factor in picking AWS CodePipeline Hope this guide helps you understand the key differences between two of most used CI CD services of aws feel free to contact me on LinkedIn You can view my badges here If you are interested in learning more about AWS then follow me on github If you liked this content then do clap and share it Thank You 2021-04-08 10:04:28
海外TECH DEV Community React Custom Hooks Tutorial - Creating useOnline, Testing and Publishing It https://dev.to/shahednasser/react-custom-hooks-tutorial-creating-useonline-testing-and-publishing-it-1bbl React Custom Hooks Tutorial Creating useOnline Testing and Publishing ItThis was originally posted on my personal blogIn this tutorial we ll go over how to create a simple custom React hook testing it locally and then publishing it on NPM The React hook we ll create isuseOnlinewhich detects if the user goes offline and shows them a message that they re offline After implementing it we ll check how we can test it locally then publishing it on NPM If you re checking out this tutorial to learn only how to create a custom hook to use it in an existing project without intending on publishing it as a package on NPM then you can stop before the testing and publishing part of this tutorial You probably also won t need to go through the Setup part as well The code for this tutorial is available on this GitHub Repository What are Custom Hooks Custom hooks hold a certain logic that makes use of React s hooks like useState useEffect etc You usually create custom hooks when a certain part of your project is reusable and makes use of React s hooks So you create a custom hook that you can use throughout your project just like you would use React s hooks It should also start with use SetupLet s start by creating a new directory and changing to it mkdir use onlinecd use onlineThen we ll initialize our NPM project npm initYou ll have to enter some information that will go into package json like package name description author main entry etc You can use the default settings for now Once you re done you ll have an empty NPM package at your hand Let s now install the dependencies we ll be using to develop our custom React hook npm i save dev react babel cli copyfilesWe re installing React since we are developing a custom hook We re also installing babel s CLI to build our code later on and we re installing copyfiles which we will use later as well when we are getting our package ready for publishing Once we re done with that we re ready to implement our custom hook Implementing useOnlineAs I mentioned in the beginning useOnlinewill detect whenever the user is online or offline This means that it will manage a state for the user s connectivity status and listen to any changes in the user s connectivity and update it accordingly So useOnlinewill make use ofuseStatusto keep track of the user s connectivity and will useuseEffectto register event listeners for the eventsonlineandofflineto set the state accordingly In the end useOnlinewill just return the state which we can use in other components to track the user s connectivity without repeating the logic behind it Let s start by creating the file that will hold our custom hook Createsrc useOnline jswith the following content import useState useEffect from react function useOnline export default useOnlineWe re just importinguseStateanduseEffectto use them in a bit declaring the custom hookuseOnlineand exporting it Now let s get to the code of the hook First let s create the state that will hold the user s connectivity function useOnline const online setOnline useState navigator onLine onlinewill hold the state of the user s connectivity and it will be a boolean If the user is online it will be true if not it will be false For its initial value we are using the value ofnavigator onLinewhich returns the online status of the browser Next we need to listen to theonlineandofflineevents Theonlineevent occurs when the user goes online and theofflineevent occurs when the user goes offline To add the listeners we will useuseEffect function useOnline const online setOnline useState navigator onLine useEffect gt window addEventListener online function TODO change state to online window addEventListener offline function TODO change state to offline So we are adding event listeners to the online and offline events insideuseEffectcallback We are also passing an empty array as a second parameter foruseEffect This ensures that the callback is only called on mounting the component Now let s add the logic inside each of the listeners We just need to change the value ofonlinebased on the event To do this we will usesetOnline useEffect gt window addEventListener online function setOnline true window addEventListener offline function setOnline false Pretty easy Our code now adds an event listener to both online and offline events which changes the value of our state online based on the user s connectivity When adding event listeners or adding any kind of subscriptions we need to make sure that we are cleaning up after the component unmounts To do that we return a function inuseEffectthat removes the event listeners on unmount Since we will be usingremoveEventListenerto remove the event listeners which takes the event listener we are moving as a second parameter let s remove our event listeners to functions that we can reference function offlineHandler setOnline false function onlineHandler setOnline true useEffect gt window addEventListener online onlineHandler window addEventListener offline offlineHandler return gt window removeEventListener online onlineHandler window removeEventListener offline offlineHandler We moved our event listeners to functions outsideuseEffect you can also add them inside instead and we are passing them as the event listeners inaddEventListenerandremoveEventListenerinsideuseEffectfor both theonlineandofflineevents The last thing we need to do in our custom hook is return the state we are changing This way we can use this state in other components with all the logic behind it in one place So the full code foruseOnlinewill be import useState useEffect from react function useOnline const online setOnline useState navigator onLine function offlineHandler setOnline false function onlineHandler setOnline true useEffect gt setOnline navigator onLine window addEventListener online onlineHandler window addEventListener offline offlineHandler return gt window removeEventListener online onlineHandler window removeEventListener offline offlineHandler return online export default useOnline That s it We created a custom hook that makes use of React hooks likeuseStateanduseEffectto determine the user s connectivity Preparing the NPM PackageIf you want to publish your custom hook on NPM you need to prepare the package to be published and used There are certain things that need to be done especially inpackage json In the beginning we installed babel cliandcopyfiles This is where we ll put them into use Package InformationWhen you first runnpm inityou are asked to enter a few information like package name description author version license etc If you ve used the default information or you want to change this information make sure you change them prior to publishing You can do that in thepackage jsonfile Note that thenameinpackage jsonis the package name that people will use to install it So make sure it s exactly what you want to call it DependenciesWhen publishing a package make sure you are listing the dependencies required correctly If some dependencies are only required during development and are not necessary to install when they are being used then include them underdevDependencies In our example we should have devDependencies react babel cli copyfiles Note that the versions might be different in your project but that s fine There s one more thing to note In a React project only one installation or instance ofreactis allowed Meaning that your package shouldn t install React as well when installing it in a project So let s changereactto be a peer dependency like this peerDependencies react devDependencies babel cli copyfiles When adding a dependency inpeerDependencies thereactpackage you are using in your project that will include this package will be used instead of installing a new one We are also allowing the version to be at least since that s when React Hooks were introduced ScriptsTo make sure our package is ready for use we will add scripts that will build our React custom hook usingbabel scripts prebuild npm i build babel src out dir dist Now whenever we runbuild prebuildwill run first to ensure that the dependencies required are installed then the build script will compile the Javascript files in oursrcdirectory which isuseOnline js and outputs the result indist mainIf we want our package to be used like this import useOnline from use online Then we need to specify what we are exporting and which file will be used for the import It s themainfile in our package In our case it will be the output of thebuildscript main dist useOnline js filesWhen publishing a package by default it will publish all the files and directories starting from the root directory This can increase the package s size significantly especially if there are a lot of redundant files or files that are not necessary for the package to be used In our example if you look at theGitHub Repository  you can see that there s anexampledirectory We will get to what that holds later but a lot of times you might have examples images or other files that might be necessary for the package development wise but not when it s published To decrease the package size and make sure only relevant files are included we use thefileskey files dist filestakes an array that holds all the files or directories that should be included in the package once published In our case it will just be thedistdirectory that will hold our built code typesThis one is purely optional and I m using it in its simplest form You can add a Typescript declaration for your package To do so we ll createsrc useOnline d tswith the following content declare module use online export default function useOnline boolean This will declare the moduleuse onlinewhich exports the functionuseOnlinethat returns boolean which is the online status Next we will add a new script inpackage json scripts prebuild npm i build babel src out dir dist postbuild copyfiles u src useOnline d ts dist Thepostbuildscript will run after thebuildscript is finished It will copysrc useOnline d tsto thedistdirectory Last we will add thetypeskey inpackage json types dist useOnline d ts This will make your package a Typescript package although in Typescript packages you wouldn t really be doing it this way This is just a simple form of how to do it Testing Our Custom Hook LocallyIf you are adding your custom hook to your existing project then you can probably just test it there However if you are creating a custom hook to publish online and you want to test it as a separate package this section is for you In theGitHub RepositoryI created for this tutorial  you can see anexamplefolder This folder holds a website built usingcreate react appthat is just used to test ouruse onlinepackage that holds theuseOnlinehook If you don t have a project to testuse online let s create one just for the purpose by running the following command npx create react app exampleThis will create a new directoryexamplethat will hold a Single Page Application SPA built with React Before changing into that directory Let s look into how we d useuse onlineif it s not actually a package on NPM As you probably already know you can install any package on NPM using theinstalloricommand like this npm install lt PACKAGE NAME gt However how do we install a package that is only available locally We will youlinking npm linkallows us to create a symlink of our package in the global folder on our machine This way we can install local packages in other projects on our machine for purposes like testing What we will do is we will create a link ofuse online then use it in theexampleproject we just created Inside the root directory ofuse onlinerun the following npm linkOnce this is done a symbolic link will be created to this package We can now change to the example directory and install theuse onlinepackage by linking to it cd examplenpm link use onlineOnce linked you can now useuse onlinein this project as if it was installed like any other NPM package Any changes you make inuse onlinewill automatically be portrayed in the package Before we can useuse online let s go its root directory and run the build command npm run buildThis will run NPM install compiles the code withbabel then if you followed along with the typescript part copies the typescript declaration file todistI recommend before testing it you remove thenode modulesdirectory As we mentioned before when usingpeerDependenciesReact will not be installed if the project you are installinguse onlineinto already has it installed However when we ran the build command the package was on its own and there was noreactdependencies installed so it installedreact Since we are linking to it and not actually installing it inexample thenode modulesdirectory ofuse onlinewill be inside thenode modulesdirectory ofexample which will lead to tworeactinstances insideexample So make sure to deletenode modulesinuse onlinebefore testing it We will just be adding three lines inexample src App js First we will import our custom hook import useOnline from use online Second inside theAppcomponent we will use theuseOnlinehook to get theonlinestate function App const online useOnline rest of the code Third and last we will add in the rendered part a condition to display to the user that they re offline return lt div className App gt lt header className App header gt online amp amp lt p gt You re Offline lt p gt lt img src logo className App logo alt logo gt lt p gt Edit lt code gt src App js lt code gt and save to reload lt p gt lt a className App link href target blank rel noopener noreferrer gt Learn React lt a gt lt header gt lt div gt Notice the line we added online amp amp lt p gt You re Offline lt p gt Whenonlineis false it means that the user is offline so we re showing them the message Remember that the logic behind changing the state based on the user s connectivity is actually done insideuseOnline We just have to use the returnedonlinevalue and everything else is done inside the custom hook Let s now start the development server by running npm startIt will just be the default React page that we see everytime we start a newcreate react appproject The best way to testuseOnlineby simulating going offline To do that open the devtools then go to the Application tabAs you can see there s a checkbox to simulate an offline browser This is used for testing service workers but it will still work for any kind of testing regarding the user s connectivity Once you check the Offline checkbox you should see the You re Offline message we added Our custom hook works Try turning it on and off When you check the Offline checkbox the message will show When you check it off the message will be removed Publishing Your Custom HookNow that we re done testing our custom hook and we configured everything in our package we are ready to publish it on NPM First make sure you have an account onNPM If you don t you need to create one first In your terminal run npm loginYou ll have to enter your username password and email If it s all correct you will be authenticated and authorized to publish your package In the root directory of your package run npm publishUnless any errors occur that s all you ll have to do Your package will be live once this command is done running If you get an error regarding an existing package with a similar name make sure to rename your package insidepackage json name NEW PACKAGE NAME Then try again If your package was published successfully you will receive an email to notify you about it and you can go ahead and view it on NPM You can then inside your project run npm install PACKAGE NAMEAnd it will be installed just like any package out there Updating Your PackageIf you later on decided to fix some bugs or make any changes in your package and you want to update it just run in the root directory of the package npm version TYPEWhere TYPE can either bepatch for small bug fixes minor for small changes andmajorfor big changes You can read more about it here 2021-04-08 10:02:58
Apple AppleInsider - Frontpage News Leaked images of revamped iPad Pro and iPad mini show few changes https://appleinsider.com/articles/21/04/08/leaked-images-of-revamped-ipad-pro-and-ipad-mini-show-few-changes Leaked images of revamped iPad Pro and iPad mini show few changesA purported image of forthcoming iPad mini dummy cases shows the same design as the iPad mini while ones for the inch iPad Pro appear to feature a reduced camera bump Purported leaked iPad Pro and iPad mini dummiesAs expectations mount that a new iPad Pro may be revealed soon a long time leaker has shown off images of dummy chassis designs Alongside dummies for both the inch and inch iPad Pro the images feature what s believed to be the next iPad mini Read more 2021-04-08 10:37:38
Apple AppleInsider - Frontpage News Apple MacBook and iPad production may be delayed over global chip shortage https://appleinsider.com/articles/21/04/08/apple-macbook-and-ipad-production-may-be-delayed-over-global-chip-shortage Apple MacBook and iPad production may be delayed over global chip shortageThe global component shortage affecting the technology industry has now caused problems for Apple too reportedly forcing it to delay orders for MacBook and iPad assembly Credit AppleInsiderDespite having appeared to weather the global chip shortage better than all its rivals Apple is now facing the same ongoing problems Read more 2021-04-08 10:20:34
海外TECH Engadget Boston Dynamics' Spot robot tested in combat training with the French army https://www.engadget.com/boston-dynamics-spot-robot-combat-training-101732374.html Boston Dynamics x Spot robot tested in combat training with the French armyBoston Dynamics robotic dog Spot was one of several robots tested by the French army during training sessions at a military school in the northwest of France 2021-04-08 10:17:32
医療系 医療介護 CBnews 未承認の治療アプリ、保険外併用制度が活用可能-厚労省 https://www.cbnews.jp/news/entry/20210408193921 保険外併用療養費 2021-04-08 19:45:00
医療系 医療介護 CBnews 専門医教育に進む前段階で総合診療深く学ぶ機会を-日本慢性期医療協会が提言 https://www.cbnews.jp/news/entry/20210408190129 入院患者 2021-04-08 19:15:00
金融 金融庁ホームページ 期間業務職員(金融サービス相談員)を募集しています。 https://www.fsa.go.jp/common/recruit/r3/sousei-05/sousei-05.html 金融サービス 2021-04-08 10:30:00
海外ニュース Japan Times latest articles China sends more jets as Taiwan says it will fight to the end if there’s war https://www.japantimes.co.jp/news/2021/04/08/asia-pacific/china-taiwan-tensions/ months 2021-04-08 19:45:16
ニュース BBC News - Home Covid: More than enough vaccines for under-30s, says Hancock https://www.bbc.co.uk/news/uk-56672504 covid 2021-04-08 10:43:50
ニュース BBC News - Home Belfast: Stormont ministers 'gravely concerned' after fresh violence https://www.bbc.co.uk/news/uk-northern-ireland-56664868 belfast 2021-04-08 10:37:26
ニュース BBC News - Home Peter Ainsworth: Boris Johnson leads tributes after death of former Tory MP https://www.bbc.co.uk/news/uk-politics-56675905 surrey 2021-04-08 10:26:05
ニュース BBC News - Home Richard Okorogheye death: Met referred to police watchdog https://www.bbc.co.uk/news/uk-england-london-56674932 epping 2021-04-08 10:23:29
ニュース BBC News - Home Grand National 2021: Cloth Cap heads Aintree field as The Storyteller is withdrawn https://www.bbc.co.uk/sport/horse-racing/56665005 aintree 2021-04-08 10:14:30
ニュース BBC News - Home Captain Hunter back for England against Italy https://www.bbc.co.uk/sport/rugby-union/56673914 Captain Hunter back for England against ItalyEngland captain Sarah Hunter will return for the first time in months as head coach Simon Middleton makes sweeping changes for Saturday s Women s Six Nations match in Italy 2021-04-08 10:09:19
ビジネス ダイヤモンド・オンライン - 新着記事 イオンモール(8905)、「増配」を発表し、配当利回り 2.1%⇒2.7%にアップ! 年間配当は1年で25%増加、 2022年2月期は前期比10円増の「1株あたり50円」に! - 配当【増配・減配】最新ニュース! https://diamond.jp/articles/-/268005 イオンモール、「増配」を発表し、配当利回り⇒にアップ年間配当は年で増加、年月期は前期比円増の「株あたり円」に配当【増配・減配】最新ニュースイオンモールが「増配」を発表し、配当利回りがにイオンモールは年月期の配当予想を「株あたり円」と発表し、前期比で「円」の増配となる見通しになった。 2021-04-08 19:55:00
LifeHuck ライフハッカー[日本版] Googleカレンダーを最強のタスク管理ツールにする方法 https://www.lifehacker.jp/2021/04/todoist-toggl-googl-calendar-time-management.html todoist 2021-04-08 20:00:00
GCP Google Cloud Platform Japan 公式ブログ デバイスとゼロトラスト https://cloud.google.com/blog/ja/topics/developers-practitioners/devices-and-zero-trust/ ゼロトラスト環境では、アクセス権を付与されるためにすべてのデバイスが信頼を獲得する必要があります。 2021-04-08 12:00:00
GCP Google Cloud Platform Japan 公式ブログ Google と National Science Foundation がクラウド リソースへのアクセスを拡大 https://cloud.google.com/blog/ja/topics/public-sector/opening-access-to-computing-power-and-training-resources-with-nsf/ このプログラムは現在から将来にかけてどのような影響をもたらすと期待されていますかPayton博士短期的に見ると、今年は初回募集として件の研究案に資金が提供されます。 2021-04-08 12:00:00
北海道 北海道新聞 第一生命、被害者3人と調停成立 89歳元社員の19億円詐取 https://www.hokkaido-np.co.jp/article/531131/ 第一生命 2021-04-08 19:43:00
北海道 北海道新聞 国内のコロナ感染、2日連続で3千人超 大阪は最多、重症者は464人 https://www.hokkaido-np.co.jp/article/531130/ 新型コロナウイルス 2021-04-08 19:42:00
北海道 北海道新聞 ユニクロ、新疆産綿の有無答えず 柳井正・ファストリ社長 https://www.hokkaido-np.co.jp/article/531115/ 衣料品店 2021-04-08 19:25:11
北海道 北海道新聞 キッチンカー、紋別快走 店主の鎌田さん、弁当や甘味販売 https://www.hokkaido-np.co.jp/article/531124/ 鎌田 2021-04-08 19:37:00
北海道 北海道新聞 知床に春近づく 横断道の除雪着々 https://www.hokkaido-np.co.jp/article/531122/ 通行止め 2021-04-08 19:34:00
北海道 北海道新聞 「松山の聖火リレー困難」と知事 愛媛、コロナ警戒レベル最高に https://www.hokkaido-np.co.jp/article/531121/ 警戒レベル 2021-04-08 19:32:00
北海道 北海道新聞 <霧多布生まれ ラッコA子の物語>4 採餌 母の見まねで貝割り https://www.hokkaido-np.co.jp/article/531120/ 離乳食 2021-04-08 19:31:00
北海道 北海道新聞 文大統領「叱責重く受け止める」 韓国2市長選惨敗受けコメント https://www.hokkaido-np.co.jp/article/531117/ 韓国 2021-04-08 19:25:00
北海道 北海道新聞 フジ、外資規制に違反と発表 14年報告時に総務省、口頭注意 https://www.hokkaido-np.co.jp/article/531119/ 外資規制 2021-04-08 19:30:00
北海道 北海道新聞 池江、100m自由形も優勝 リレー2種目で五輪代表に https://www.hokkaido-np.co.jp/article/531092/ 池江璃花子 2021-04-08 19:12:48
北海道 北海道新聞 厚労省ワクチンシステムに不具合 接種回数表示機能が停止 https://www.hokkaido-np.co.jp/article/531114/ 厚生労働省 2021-04-08 19:16:00
北海道 北海道新聞 なでしこ、パラグアイに大勝 仙台で女子国際親善試合 https://www.hokkaido-np.co.jp/article/531113/ 国際親善試合 2021-04-08 19:14:00
北海道 北海道新聞 長沼高の制服 おしゃれに一新 人気デザイン採用、新入生増加に効果 https://www.hokkaido-np.co.jp/article/531111/ 長沼 2021-04-08 19:11:00
北海道 北海道新聞 オンワード、連結赤字231億円 コロナ禍で売上高3割減 https://www.hokkaido-np.co.jp/article/531110/ 連結 2021-04-08 19:11:00
北海道 北海道新聞 フェースガード登壇で騒然 自民渡嘉敷氏、野党抗議 https://www.hokkaido-np.co.jp/article/531109/ 渡嘉敷奈緒美 2021-04-08 19:10:00
北海道 北海道新聞 相沢、五輪は1万mに絞って勝負 5000m代表は狙わず https://www.hokkaido-np.co.jp/article/531053/ 日本記録 2021-04-08 19:10:14
北海道 北海道新聞 苫小牧東小のビオトープ7月閉鎖 旧校舎解体に伴い 自然学ぶ場 惜しむ声 https://www.hokkaido-np.co.jp/article/531107/ 惜しむ声 2021-04-08 19:06:00
北海道 北海道新聞 まん延防止措置「意味あるのか」 東京都内、効果疑問視する声 https://www.hokkaido-np.co.jp/article/531108/ 東京都内 2021-04-08 19:07:00
北海道 北海道新聞 大学、またオンライン授業に? 小池氏発言に学生ら困惑 https://www.hokkaido-np.co.jp/article/531106/ 小池百合子知事 2021-04-08 19:04:00
ニュース Newsweek 北米からシカの狂牛病=狂鹿病が、世界に広がる...... https://www.newsweekjapan.jp/stories/world/2021/04/post-96024.php アメリカ州、カナダ、欧州、韓国に感染は広がったシカ慢性消耗病は、年に米コロラド州で初めてその症状が確認され、年に正式に伝達性海綿状脳症の一種として分類された。 2021-04-08 19:33:37
IT 週刊アスキー 「ニフクラ」「FJcloud-V」にてPostgreSQLベースのデータベースを提供開始 https://weekly.ascii.jp/elem/000/004/050/4050843/ fjcloudv 2021-04-08 19:40:00
IT 週刊アスキー DNP、1枚あたりおよそ9.8gのCO2排出量を削減するICカードの製造開始 https://weekly.ascii.jp/elem/000/004/050/4050835/ 開始 2021-04-08 19:30:00
IT 週刊アスキー 『戦国無双5』武田信玄(CV. 浜田賢二さん)や上杉謙信(CV. 興津和幸さん)など新武将5名を公開!第三回公式番組は4月23日に決定 https://weekly.ascii.jp/elem/000/004/050/4050841/ 配信決定 2021-04-08 19:30:00
IT 週刊アスキー 『アークナイツ- 明日方舟 -』で期間限定イベント「マリア・ニアール」開催中! https://weekly.ascii.jp/elem/000/004/050/4050839/ yostar 2021-04-08 19:10:00
GCP Cloud Blog JA デバイスとゼロトラスト https://cloud.google.com/blog/ja/topics/developers-practitioners/devices-and-zero-trust/ ゼロトラスト環境では、アクセス権を付与されるためにすべてのデバイスが信頼を獲得する必要があります。 2021-04-08 12:00:00
GCP Cloud Blog JA Google と National Science Foundation がクラウド リソースへのアクセスを拡大 https://cloud.google.com/blog/ja/topics/public-sector/opening-access-to-computing-power-and-training-resources-with-nsf/ このプログラムは現在から将来にかけてどのような影響をもたらすと期待されていますかPayton博士短期的に見ると、今年は初回募集として件の研究案に資金が提供されます。 2021-04-08 12:00:00

コメント

このブログの人気の投稿

投稿時間: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件)

投稿時間:2024-02-12 22:08:06 RSSフィード2024-02-12 22:00分まとめ(7件)