Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rails 複数 画像投稿 Cloudinary CarrierWave |
https://qiita.com/kakeru0520sou1/items/015d283ed9db6ebca1a0
|
credentialsymlencawsaccesskeyidsecretaccesskeycloudinarycloudnameapikeyapisecretUsedasthebasesecretforallMessageVerifiersinRailsincludingtheoneprotectingcookiessecretkeybaseddの値はCloudinaryのマイページから取得した値に変更してください。 |
2022-01-23 08:26:31 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
form_withを使ったRails.fireの使い方 |
https://qiita.com/yamanoura/items/767e61fa5e5d90fca0bb
|
formwithを使ったRailsfireの使い方formwithを使ったRailsfireの使い方JS側からsubmitを行う方法として、Railsfireを使う方法があります。 |
2022-01-23 08:25:37 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
FactoryBot(Rails)のtraitとは |
https://qiita.com/soicchi/items/39d4cb051d03df38df88
|
specmodelsuserspecrbRSpecdescribeUsertypemodeldodescribeバリデーションに関するテストdoletoverlengthnamealetusercreateusernameoverlengthnamerailshelperrbに設定定義済みendendまとめ例のようにtraitを使用することによってよりコードを簡潔に記載することができるようになるので積極的に使用していこうと思いました。 |
2022-01-23 08:03:11 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
サーバー(実機)まで行くの面倒くさい!Windows10からUbuntuへリモートデスクトップできるようにしたい! |
https://qiita.com/waokitsune/items/fec2ec852d0d89832895
|
サーバーのIPアドレスを指定してリモートデスクトップ開始認証画面入力して、さあリモートデスクトップできるかな…結果は暗黒…実はサーバーUbuntu側はログアウトしておくことが必須なんです。 |
2022-01-23 08:02:03 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Rails 複数 画像投稿 Cloudinary CarrierWave |
https://qiita.com/kakeru0520sou1/items/015d283ed9db6ebca1a0
|
credentialsymlencawsaccesskeyidsecretaccesskeycloudinarycloudnameapikeyapisecretUsedasthebasesecretforallMessageVerifiersinRailsincludingtheoneprotectingcookiessecretkeybaseddの値はCloudinaryのマイページから取得した値に変更してください。 |
2022-01-23 08:26:31 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
form_withを使ったRails.fireの使い方 |
https://qiita.com/yamanoura/items/767e61fa5e5d90fca0bb
|
formwithを使ったRailsfireの使い方formwithを使ったRailsfireの使い方JS側からsubmitを行う方法として、Railsfireを使う方法があります。 |
2022-01-23 08:25:37 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
FactoryBot(Rails)のtraitとは |
https://qiita.com/soicchi/items/39d4cb051d03df38df88
|
specmodelsuserspecrbRSpecdescribeUsertypemodeldodescribeバリデーションに関するテストdoletoverlengthnamealetusercreateusernameoverlengthnamerailshelperrbに設定定義済みendendまとめ例のようにtraitを使用することによってよりコードを簡潔に記載することができるようになるので積極的に使用していこうと思いました。 |
2022-01-23 08:03:11 |
海外TECH |
DEV Community |
React local development and testing mocking with msw and mswjs/data |
https://dev.to/jericopingul/react-local-development-and-testing-mocking-with-msw-and-mswjsdata-obl
|
React local development and testing mocking with msw and mswjs data BackgroundRecently I found myself needing to mock CRUD operations from an API At that time the API was being developed by another engineer We agreed on the API specs which allowed me to progress on building the UI During development the mocked APIs are useful to build to mock the actual API implementation During testing it is also valuable to be able to test the actual user interactions There are amazing blog posts by Kent C Dodds author of testing library react on avoiding testing implementation details and mocking the actual API over mocking fetch In this article we will go though the approach I went to building this mock server using msw by building a simple pet dog CRUD application that has the following features List all dogsCreate a dogUpdate a dogDelete a dogAdditionally data can be stored in memory database provided by a standalone data library msw datajs This provides the capabilities of describing our data persisting them in memory and read write operations We will explore writing REST API handlers backed by the data library methods SetupIn this article l will be building a simple CRUD React application To help quickly bootstrap my application I will be using the vitejs react ts template and Chakra UI components To help simplify and abstract our data fetching and manage server state react query will be used For this demo we will need to install the msw libraries and a mock generator faker At the time of writing the latest version of faker has “endgamed For this post we ll use version which still works yarn add msw mswjs datayarn add faker Data modelModels are blueprint of data and entities are instances of models Each model requires a primary key that is a unique ID in a traditional database Here we define our dog model Each property in the model definition has an initializer that seeds a value and infers the type Each model must have a primary key that is a unique ID that we may be familiar with in traditional databases import factory primaryKey from mswjs data import faker from faker const modelDictionary dog id primaryKey faker datatype uuid breed gt faker helpers randomize BREEDS age gt faker datatype number description gt faker lorem words owner gt faker name firstName faker name lastName const db factory modelDictionary Seeding dataOnce the database is created we can seed it with data Properties that aren t set in the create method will be resolved by the model dictionary definition export function seedDb db dog create owner Jerico breed maltese db dog create owner Jerry breed pug Request handlersThese are functions that will mock the API requests from our app In this app we will be using the rest handlers to mock our REST API More information on the syntax can be found in the msw docs export const handlers rest get lt DefaultRequestBody PathParams Dog gt api dogs req res ctx gt return res ctx json db dog getAll rest post lt Omit lt Dog id gt PathParams Dog gt api dogs req res ctx gt const created db dog create req body return res ctx json created rest delete lt DefaultRequestBody id string Dog gt api dogs id req res ctx gt db dog delete where id equals req params id return res ctx status rest put lt Omit lt Dog id gt id string Dog gt api dogs id req res ctx gt const updated db dog update where id equals req params id data req body return res ctx json updated Alternatively mswjs data provides a neat method that actually generates these request handlers using the following Do note that the generated routes are in the following conventional format const handlers db user toHandlers rest Running msw In the browserIn our source code we can execute the following line Note that we may want to conditionally execute this only on our local dev server import setupWorker from msw setupWorker handlers start In the testsSimilarly to mock API requests in our tests import setupServer from msw node const server setupServer handlers beforeAll gt server listen afterAll gt server close ImplementationThe implementation will not be included in this post but the full source code can be found in my repo and deployed here Wrap upWriting a mock API using msw and mswjs data allowed me to develop the UI while the actual API was being developed by another engineer This setup also allowed me to write the request handlers only once for both my development server and tests This personally made the effort worthwhile and made writing my tests enjoyable I hope this is something that will be of benefit to you as much as it was for me Further readingIn a more complex application we could have multiple data models and can have relationships with each other mswjs data allows establishing relationships between our models in the docs here Additionally there are more model methods to explore I like the way the API is likened to SQL and take inspiration from prisma io mswjs data supports GraphQL as well which I d love to explore in my next project |
2022-01-22 23:35:03 |
Apple |
AppleInsider - Frontpage News |
UK Apple Stores start to accept walk-in customers again |
https://appleinsider.com/articles/22/01/22/uk-apple-stores-start-to-accept-walk-in-customers-again?utm_medium=rss
|
UK Apple Stores start to accept walk in customers againApple is opening up a number of its Apple Stores in the UK to walk in customers by dropping a requirement to attend a session with a reservation Apple Store White CitySince the introduction of Plan B measures by the UK government in December to counter a rise in Omicron variant COVID infections Apple limited access to its stores only to customers with an appointment Apple is now starting to open the stores back up to passing trade Read more |
2022-01-22 23:04:32 |
ニュース |
BBC News - Home |
German navy chief resigns over Ukraine comments |
https://www.bbc.co.uk/news/world-europe-60099924?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-01-22 23:42:07 |
ニュース |
BBC News - Home |
England routed by West Indies in first T20 |
https://www.bbc.co.uk/sport/cricket/60099674?at_medium=RSS&at_campaign=KARANGA
|
barbados |
2022-01-22 23:12:25 |
LifeHuck |
ライフハッカー[日本版] |
デスクワークが捗る&快適に!ロジクールの「魔法のマット」 |
https://www.lifehacker.jp/article/roomie-logicool/
|
魔法 |
2022-01-22 23:30:00 |
ビジネス |
東洋経済オンライン |
マニアもうなるシトロエン新型C4「伝統の味」 伝統+革新「シトロエンらしさ」満載の新境地 | 森口将之の自動車デザイン考 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/503954?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2022-01-23 08:30:00 |
海外TECH |
reddit |
100 Thieves vs. Dignitas / LCS 2022 Lock In - Quarter-Final / Post-Match Discussion |
https://www.reddit.com/r/leagueoflegends/comments/saexux/100_thieves_vs_dignitas_lcs_2022_lock_in/
|
Thieves vs Dignitas LCS Lock In Quarter Final Post Match DiscussionLCS LOCK IN Official page Leaguepedia Liquipedia Eventvods com New to LoL Thieves Dignitas Leaguepedia Liquipedia Website Twitter Facebook YouTube Subreddit DIG Leaguepedia Liquipedia Website Twitter Facebook YouTube Subreddit MATCH vs DIG Winner Dignitas in m Game Breakdown Bans Bans G K T D B xin Zhao leblanc akali jayce kennen k H H DIG diana twisted fate corki lux thresh k M I I B E vs DIG Ssumday gwen TOP gragas FakeGod Closer viego JNG jarvan Iv River Abbedagge orianna MID viktor Blue FBI caitlyn BOT ezreal Neo huhi lulu SUP karma Biofrost MATCH DIG vs Winner Dignitas in m Game Breakdown Bans Bans G K T D B DIG diana gwen twisted fate viktor jayce k H C B xin Zhao corki leblanc orianna gragas k H O DIG vs FakeGod renekton TOP gnar Ssumday River jarvan IV JNG viego Closer Blue zoe MID syndra Abbedagge Neo aphelios BOT caitlyn FBI Biofrost thresh SUP karma huhi This thread was created by the Post Match Team We are looking for volunteers to help out with Post Match Threads Please send a message to reddit user lolpmtc with your email address to join by January submitted by u TomShoe to r leagueoflegends link comments |
2022-01-22 23:15:03 |
ニュース |
THE BRIDGE |
ブロックチェーンゲーム・メタバース特化ローンチパッド「Enjinstarter」、Web3投資のTGVから300万米ドル調達 |
https://thebridge.jp/2022/01/enjinstarter-raises-us3m-funding-true-global-ventures-20220121
|
ブロックチェーンゲーム・メタバース特化ローンチパッド「Enjinstarter」、Web投資のTGVから万米ドル調達シンガポールに拠点を置くTrueGlobalVenturesPlusTGVPlusは、メタバースやブロックチェーンゲームプロジェクトのためのIDOInitialDEXOfferingローンチパッド「Enjinstarter」に万米ドルを出資した。 |
2022-01-22 23:15:06 |
コメント
コメントを投稿