python |
Pythonタグが付けられた新着投稿 - Qiita |
AtCoder Beginner Contest 259 参戦記 |
https://qiita.com/c-yan/items/8257f037e76514e68549
|
nmxtdmapintin |
2022-07-10 20:50:20 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
何も分からないが頑張って参院選の結果をTwitterから予測しようとする #0. 準備の準備 |
https://qiita.com/sakigakeman/items/3e50e88de211afe51e9d
|
twitter |
2022-07-10 20:37:00 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS EKSの運用は実家の猫に任せてお前は先に行け |
https://qiita.com/ryotayaguchi/items/df6acd5b9eb11b436da6
|
awseks |
2022-07-10 20:57:01 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
3大クラウドのIoTサービスに接続してみた |
https://qiita.com/moritalous/items/948615fcb89de3cb6ad5
|
awsiotcore |
2022-07-10 20:06:23 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
Dockerコンテナの再起動ポリシーを設定する |
https://qiita.com/ryot0/items/41f1cc2907b375298328
|
terestartalwayscontanerid |
2022-07-10 20:49:34 |
GCP |
gcpタグが付けられた新着投稿 - Qiita |
3大クラウドのIoTサービスに接続してみた |
https://qiita.com/moritalous/items/948615fcb89de3cb6ad5
|
awsiotcore |
2022-07-10 20:06:23 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
3大クラウドのIoTサービスに接続してみた |
https://qiita.com/moritalous/items/948615fcb89de3cb6ad5
|
awsiotcore |
2022-07-10 20:06:23 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
【Github】初めてチーム開発へ参加してみて学べたこと |
https://qiita.com/ttaku17/items/c7e8534a67b2ce8011d5
|
github |
2022-07-10 20:53:28 |
海外TECH |
Ars Technica |
“Downright nasty” weather couldn’t stop the 100th Pikes Peak hillclimb |
https://arstechnica.com/?p=1865342
|
beasts |
2022-07-10 11:30:47 |
海外TECH |
DEV Community |
How to build a mega menu with Tailwind CSS and Flowbite |
https://dev.to/themesberg/how-to-build-a-mega-menu-with-tailwind-css-and-flowbite-2nmh
|
How to build a mega menu with Tailwind CSS and FlowbiteSince a few months ago I have started a series of tutorials on how to build some of the most commonly used UI components in Tailwind CSS and Flowbite and today I would like to show you how to build a mega menu component Tailwind CSS is the most popular utility first CSS framework that helps you build UI interfaces in websites much faster directly from your HTML Flowbite is an open source component library built with the Tailwind CSS classes featuring interactive elements like dropdowns modals navbars mega menus and more Here s a preview of how the mega menu will look like after going through this tutorial Without further ado let s get started Tailwind CSS Mega MenuFirst of all we need to make sure that we have both Tailwind CSS and Flowbite installed in your local project We need Tailwind CSS to make the classes work and Flowbite to enable the interactivity of the collapse and dropdown functionality Follow the instruction on how to install Tailwind CSS Then follow the instructions on how to install Flowbite If you have both installed then let s just go to the Tailwind CSS Mega Menu component from the documentation As you can see there are about five examples at the time of this writing and you can directly just copy paste the code into your own project and the mega menu will work instantly The good news is that all of these components are open source under the MIT license and you can use them freely Here is the code that we can use for the first example lt nav class bg white border gray px lg px py dark bg gray gt lt div class flex flex wrap justify between items center mx auto max w screen xl gt lt a href class flex items center gt lt img src class mr h sm h alt Flowbite Logo gt lt span class self center text xl font semibold whitespace nowrap dark text white gt Flowbite lt span gt lt a gt lt div class flex items center lg order gt lt a href class text gray dark text white hover bg gray focus ring focus ring gray font medium rounded lg text sm px py lg px lg py mr dark hover bg gray focus outline none dark focus ring gray gt Login lt a gt lt a href class text white bg blue hover bg blue focus ring focus ring blue font medium rounded lg text sm px py lg px lg py mr dark bg blue dark hover bg blue focus outline none dark focus ring blue gt Sign up lt a gt lt button data collapse toggle mega menu type button class inline flex items center p ml text sm text gray rounded lg lg hidden hover bg gray focus outline none focus ring focus ring gray dark text gray dark hover bg gray dark focus ring gray aria controls mega menu aria expanded false gt lt span class sr only gt Open main menu lt span gt lt svg aria hidden true class w h fill currentColor viewBox xmlns gt lt path fill rule evenodd d M a ha Ha zM a ha Ha zM a ha Ha z clip rule evenodd gt lt path gt lt svg gt lt button gt lt div gt lt div id mega menu class hidden justify between items center w full text sm lg flex lg w auto lg order gt lt ul class flex flex col mt font medium lg flex row lg space x lg mt gt lt li gt lt a href class block py pr pl text blue border b border gray hover bg gray lg hover bg transparent lg border lg hover text blue lg p dark text blue lg dark hover text blue dark hover bg gray dark hover text blue lg dark hover bg transparent dark border gray aria current page gt Home lt a gt lt li gt lt li gt lt button id mega menu dropdown button data dropdown toggle mega menu dropdown class flex justify between items center py pr pl w full font medium text gray border b border gray lg w auto hover bg gray lg hover bg transparent lg border lg hover text blue lg p dark text gray lg dark hover text blue dark hover bg gray dark hover text blue lg dark hover bg transparent dark border gray gt Company lt svg aria hidden true class ml w h lg w lg h fill currentColor viewBox xmlns gt lt path fill rule evenodd d M a L l a l a l a z clip rule evenodd gt lt path gt lt svg gt lt button gt lt div id mega menu dropdown class grid hidden absolute z grid cols w auto text sm bg white rounded lg border border gray shadow md dark border gray lg grid cols dark bg gray data popper placement bottom style position absolute inset px auto auto px margin px transform translated px px px gt lt div class p pb text gray lg pb dark text white gt lt ul class space y gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt About Us lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Library lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Resources lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Pro Version lt a gt lt li gt lt ul gt lt div gt lt div class p pb text gray lg pb dark text white gt lt ul class space y gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Blog lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Newsletter lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Playground lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt License lt a gt lt li gt lt ul gt lt div gt lt div class p text gray dark text white gt lt ul class space y gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Contact Us lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Support Center lt a gt lt li gt lt li gt lt a href class text gray dark text gray hover text blue dark hover text blue gt Terms lt a gt lt li gt lt ul gt lt div gt lt div gt lt li gt lt li gt lt a href class block py pr pl text gray border b border gray hover bg gray lg hover bg transparent lg border lg hover text blue lg p dark text gray lg dark hover text blue dark hover bg gray dark hover text blue lg dark hover bg transparent dark border gray gt Team lt a gt lt li gt lt li gt lt a href class block py pr pl text gray border b border gray hover bg gray lg hover bg transparent lg border lg hover text blue lg p dark text gray lg dark hover text blue dark hover bg gray dark hover text blue lg dark hover bg transparent dark border gray gt Contact lt a gt lt li gt lt ul gt lt div gt lt div gt lt nav gt Make sure that the id s for the navigation bar and the dropdown are all unique to prevent duplication The dropdown itself is powered using the data dropdown toggle data attribute from the Flowbite JavaScript file that is why you need it included into your own project Here are a few more examples from the Flowbite library Dark modeThe good news is that they also work with dark mode when integrated with Tailwind CSS and Flowbite Here s an example ConclusionThat s all I hope that this article has helped you get started with your Tailwind CSS and Flowbite journey and let me know in the comments section what you think about it Credits Tailwind CSSFlowbite |
2022-07-10 11:13:15 |
海外TECH |
DEV Community |
Create Custom Laravel Validation Rule for Total Uploaded Files Size 🚫✅ |
https://dev.to/moose_said/create-custom-laravel-validation-rule-for-total-uploaded-files-size-1odb
|
Create Custom Laravel Validation Rule for Total Uploaded Files Size I m currently working on a major side project that takes up practically all of my free time In this project I had to check an array of submitted files to ensure that the total size was less than mb I couldn t find anything in Laravel s validation docs that could accomplish that for me so I decided I d have to write my own custom validation rule I decided to spend a few minutes writing a quick tutorial on how I achieved my goal and created my own custom validation rule for an array of files Let s get started Table of Content Input Routes Validation Custom validation Input This is a simple HTML input tag that supports specific picture formats as well as multiple file uploads The input is wrapped with a form that POST the files to the images upload route lt form action images upload method POST gt lt input type file id thumbnail name thumbnail class h full w full z opacity cursor pointer accept image png image jpeg image jpg image gif image webp multiple required gt lt form gt Routes In routes web php file we re using the ImageUploadController store to handle post requests to this route Route post images upload ImageUploadController class store gt name images upload Validation I usually don t ever do any validation within my controller I follow the documentation to create a new request with php artisan make request StoreImagesRequest and then Add my validation as showing below public function rules return images gt bail required images gt bail image mimes jpeg jpg png gif webp It really won t matter if you do your validation inside the controller store method my solution will work either ways Custom validation Following the documentation next this step should be running the following command php artisan make rule Maxsize invokable and head to app Rules Maxsize file A rule object contains a single method invoke This method receives the attribute name its value and a callback that should be invoked on failure with the validation error message lt phpnamespace App Rules use Illuminate Contracts Validation InvokableRule class Maxsize implements InvokableRule Run the validation rule param string attribute param mixed value param Closure fail return void public function invoke attribute value fail Logic goes here The above code shows an empty rule that receives Attribute Value and Fail All we need to do is code our validation logic in the invoked function and deliver a response if it fails If you did not specify an attribute like in our case disregard the attribute variable Your input data will be stored in the value variable and we can define a response if our validation fails by assigning a string response to the fail variable Now let s get back to our goal What we want to do here is loop over an array of files compute the total file size of each file and then send a failure response if the result is greater than kilobytes For that we re going to use array reduce php function array reduce ーIteratively reduce the array to a single value using a callback function public function invoke attribute value fail total size array reduce value function sum item each item is UploadedFile Object sum filesize item gt path return sum if total size gt fail Total images size should be maximum Megabytes In this code we re returning a single value out of the array by calculating the total file size To calculate each file size we re using PHP s function filesize and passing to it the file path using Laravel s helper function path And then checking if the total size is over than mb then returning the fail variable value Now we can use our Validation rule by importing it to whatever place we re using for validation in my case StoreImagesRequest php lt phpnamespace App Http Requests use App Rules Maxsize use Illuminate Foundation Http FormRequest use Illuminate Validation Rule class StoreImagesRequest extends FormRequest Determine if the user is authorized to make this request return bool public function authorize return true Get the validation rules that apply to the request return array lt string mixed gt public function rules return images gt bail required new Maxsize images gt bail image mimes jpeg jpg png gif webp I hope this was a clear explanation and please let me know in the comments if you have any questions |
2022-07-10 11:06:55 |
Apple |
AppleInsider - Frontpage News |
M2 MacBook Air matches 13-inch MacBook Pro in first benchmark |
https://appleinsider.com/articles/22/07/10/m2-macbook-air-matches-13-inch-macbook-pro-in-first-benchmark?utm_medium=rss
|
M MacBook Air matches inch MacBook Pro in first benchmarkThe first Geekbench results for the M chip in the MacBook Air have surfaced indicating that users should see the same performance as in the new inch MacBook Pro for typical usage The initial wave of M equipped Apple Silicon devices the updated MacBook Air and the upgraded inch MacBook Pro have the potential to differ in performance due to variations in cooling However an initial benchmark of the M MacBook Air seems to indicate that the difference may not be felt that much by users According to the Geekbench result spotted by Twitter user Mr Macintosh the first M MacBook Air result has appeared in the benchmark tool s online browser Performed on Friday the result for the Mac indicates a single core score of and a multi core score of Read more |
2022-07-10 11:40:11 |
海外ニュース |
Japan Times latest articles |
LDP-led coalition’s Upper House victory heralds new start for Kishida |
https://www.japantimes.co.jp/news/2022/07/10/national/politics-diplomacy/2022-upper-house-election-result/
|
LDP led coalition s Upper House victory heralds new start for KishidaThe ruling parties are on course to maintain a majority of seats in the Upper House according to an exit poll while pro constitutional revision forces |
2022-07-10 20:04:22 |
海外ニュース |
Japan Times latest articles |
The true legacy of Shinzo Abe’s foreign policy |
https://www.japantimes.co.jp/opinion/2022/07/10/commentary/japan-commentary/shinzo-abe-foreign-policy/
|
china |
2022-07-10 20:05:55 |
ニュース |
BBC News - Home |
Tory leadership race: Rivals battle over tax cutting pledges |
https://www.bbc.co.uk/news/uk-politics-62112006?at_medium=RSS&at_campaign=KARANGA
|
minister |
2022-07-10 11:44:19 |
ニュース |
BBC News - Home |
Flights will be more expensive, says IATA's Willie Walsh |
https://www.bbc.co.uk/news/business-62112204?at_medium=RSS&at_campaign=KARANGA
|
walsh |
2022-07-10 11:14:37 |
ニュース |
BBC News - Home |
Russian rockets kill 15 in Chasiv Yar housing block, Ukraine says |
https://www.bbc.co.uk/news/world-europe-62113185?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-07-10 11:30:02 |
ニュース |
BBC News - Home |
Reality TV star Lauren Goodger announces death of baby |
https://www.bbc.co.uk/news/uk-england-essex-62112884?at_medium=RSS&at_campaign=KARANGA
|
lorena |
2022-07-10 11:37:25 |
ニュース |
BBC News - Home |
Man dies after fall from bonfire |
https://www.bbc.co.uk/news/uk-northern-ireland-62111760?at_medium=RSS&at_campaign=KARANGA
|
ambulance |
2022-07-10 11:52:05 |
ニュース |
BBC News - Home |
Austrian Grand Prix: Lewis Hamilton says fans cheering after crash was 'mind-blowing' |
https://www.bbc.co.uk/sport/formula1/62110154?at_medium=RSS&at_campaign=KARANGA
|
Austrian Grand Prix Lewis Hamilton says fans cheering after crash was x mind blowing x Lewis Hamilton criticises spectators at the Austrian Grand Prix for cheering when he crashed in qualifying at the Red Bull Ring |
2022-07-10 11:05:06 |
北海道 |
北海道新聞 |
れいわ、比例で1議席獲得が確実 山本代表も当選の可能性 |
https://www.hokkaido-np.co.jp/article/704004/
|
比例代表 |
2022-07-10 20:46:56 |
北海道 |
北海道新聞 |
首相、内閣改造へ調整着手 大型補正予算も本格検討 |
https://www.hokkaido-np.co.jp/article/704005/
|
内閣改造 |
2022-07-10 20:45:30 |
北海道 |
北海道新聞 |
「参政党」、比例で1議席獲得 SNSで支持拡大 |
https://www.hokkaido-np.co.jp/article/703998/
|
政治団体 |
2022-07-10 20:44:06 |
北海道 |
北海道新聞 |
国内感染3日連続5万人超 コロナ、前週比2・3倍 |
https://www.hokkaido-np.co.jp/article/703996/
|
新型コロナウイルス |
2022-07-10 20:12:00 |
北海道 |
北海道新聞 |
オ10―1ロ(10日) 田嶋が5勝目 |
https://www.hokkaido-np.co.jp/article/703993/
|
田嶋 |
2022-07-10 20:04:08 |
海外TECH |
reddit |
20時だよ、日本終了 |
https://www.reddit.com/r/newsokuexp/comments/vvp7fg/20時だよ日本終了/
|
ornewsokuexplinkcomments |
2022-07-10 11:07:48 |
海外TECH |
reddit |
自公、過半数を確保 参院選 |
https://www.reddit.com/r/newsokuexp/comments/vvp59g/自公過半数を確保_参院選/
|
ornewsokuexplinkcomments |
2022-07-10 11:03:30 |
コメント
コメントを投稿