IT |
気になる、記になる… |
【セール】Amazonやビックカメラなどで「Google Pixel Tablet」が最大8,570円オフ+1%ポイント還元に |
https://taisy0.com/2023/08/16/175423.html
|
amazon |
2023-08-16 11:32:46 |
IT |
気になる、記になる… |
「iPhone 15」のUSB-CポートはThunderboltに対応か |
https://taisy0.com/2023/08/16/175426.html
|
apple |
2023-08-16 11:31:08 |
TECH |
Techable(テッカブル) |
“医師の働き方改革”対応の医療機関向け労働時間管理サービス登場。職員中心の勤怠管理へ |
https://techable.jp/archives/216905
|
働き方改革 |
2023-08-16 11:00:36 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS EC2初期設定をユーザーデータで |
https://qiita.com/AlmondTofu/items/58c454858ae2e28f9359
|
cloudforma |
2023-08-16 21:00:01 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【個人開発/未経験】エモさたっぷりプロフィール帳アプリ開発してみた【Next.js + Rails API】 |
https://qiita.com/mitsu30/items/9d30da75941e328b541f
|
nextjsrailsapi |
2023-08-16 20:26:34 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
`shallow`オプション |
https://qiita.com/Gaku_RUNTEQ/items/e4ba22e807faddf00333
|
rails |
2023-08-16 20:03:32 |
技術ブログ |
Developers.IO |
同期ブロックを使う上で引っかかりやすい点をおさらいしてみた #Notion |
https://dev.classmethod.jp/articles/how-to-use-sync-blocks/
|
notionnotion |
2023-08-16 11:22:37 |
海外TECH |
DEV Community |
Impossible⁉️ CSS only syntax highlighting 😱 ...with a single element and GRADIENTS 🤯 |
https://dev.to/grahamthedev/impossible-css-only-js-syntax-highlighting-with-a-single-element-and-gradients-243j
|
Impossible️CSS only syntax highlighting with a single element and GRADIENTS Awww shi here we go again Yes I am back breaking the internet once more I know it has been a while But this time I may have come up with something kind of useful We will see First of all the title is not clickbait I have actually built a buggy syntax highlighting system that uses just a single element and can function in pure CSS for displaying snippets No lt span gt elements for each different part of syntax that is highlighted no bulky JavaScript libraries to render everything Sounds interesting Let s jump right in with a code example An exampleLook at this beautiful syntax highlighting All done in less than kb of code Here is the HTML lt pre gt let thisContent highlighted for x x amp lt x console log loopy loopy loop x lt pre gt And here is the CSS body background color padding px color white font size pre width ch font family monospace font size px line height px background linear gradient to right white ch dce ch dce ch white ch white ch FFD ch FFD ch white ch white ch linear gradient to right white ch aee ch aee ch white ch white ch f ch f ch AC ch AC ch white ch white ch linear gradient to right white ch white ch white ch fdf ch fdf ch white ch white ch aee ch aee ch white ch white ch FFD ch FFD ch f ch f ch white ch white ch linear gradient to right white ch white ch white ch linear gradient to right white ch white ch white ch background repeat no repeat background size ch px ch px ch px ch px ch px background clip text webkit background clip text color transparent That is it So what So highlight js one of the leading syntax highlighting libraries is wait for it Kb and that is minified and gZipped It is over kb of raw JS That is a huge amount of JS to push down the wire if all you are wanting to do is show a code snippet with some syntax highlighting Yet many sites do this destroying their performance So while the demo may not look that impressive the data saving is pretty impressive Explanation how does it work So what we are doing is applying a very carefully created background linear gradient to the lt pre gt element that looks like this Each of the coloured blocks corresponds to some text we want to highlight Then all we do is use background clip text a CSS property that allows us to say hey can you please use the text above the background as a mask and only show the background if there is text in front of it otherwise show a transparent background And we end up with this example Working Example But if it is that easy then why doesn t everyone do this The short answer is linear gradients and alignment To try and align the linear gradient by hand would take a lot of time Also this relies on lines not wrapping as otherwise the gradient will not align anymore although with some clever maths we could probably account for this Not part of this demo though You see in order to generate the gradient we need to know how wide each highlighted section to be generated ishow many lines of text there areto know what colour each part needs to be highlighted in The second part is straight forward But working out the width of each item to be highlighted is hard working out what to highlight is really hard Luckily I am silly enough to build a fully working editor which finds relevant tokens within a JavaScript snippet and then uses these to calculate where each part of the linear gradient should be Wanna try it The Snippet generatorInstructions Input Enter a short JS snippet in the first box Preview Check that the preview is as expected Preview this is a janky setup for highlighting it may fail on certain snippets Output Copy and paste the resulting code from the output section into your code Don t forget this is designed for a dark background so you need a dark background on either your lt body gt element or to create a wrapper around the lt pre gt element and give that a dark background Due to limitations of this demo please make sure that no line is more than characters in length That is it give it a try below Understanding how this worksLook that JavaScript is a hot mess of cobbled together snippets I would not expect you to try and follow it Here is the simplified version of what is happening though We grab each line in the input section and loop through it We use a RegEx yes I know to capture key terms in JavaScript such as let and function etc We then create a linear gradient for each line with the length of each section of the gradient corresponding to found matches Finally we adjust the background size CSS property to account for the height of the given lines of code so that each linear gradient declaration we have lines up with the length and height of each line of code That last part might be the most confusing part To explain better think of the following let a test let b a your code Let s assume that all we want to do is highlight the strings in these two lines test and your code So we need gradients They need to be characters long the length of the longest line and we need to have a coloured block appear at character to on line character to on line These turn into linear gradients as follows linear gradient to right white ch white ch red ch red ch white ch white ch linear gradient to right white ch white ch red ch red ch white ch white ch Where red is our highlight colour and white is our non highlighted colour our characters are indexed in case you wonder why the number position of each character is less BUT if we just tried to use those two gradients on their own it would fail This is because the first gradient has taken up of the height So to fix this we need to set the height of each of the linear gradient declarations using background size This would look like this background size ch px ch px Assuming a line height of px so the first gradient is px high from the top to cover the height of the first line and then the second gradient is px high from the top to cover the second line This is because linear gradients stack on top of each other and the one that is declared first is on top Oh but it still doesn t work yet You see gradients repeat by default So we also need to set background repeat no repeat Now we get a working highlight on the strings And that is essentially it just add different colours for each type of token and you have a working syntax highlighting system in pure CSS with no lt span gt elements But why Ok ok You have now read the whole article and are still asking why That is fair To be honest I just had a silly idea But also I like to take something and use it in a way that was not intended I find it a great way to learn as there are no tutorials I can follow for things like this I just have to keep trying things and work out how to solve the problem It also really helps you learn things more deeply for example I learned a couple of things with linear gradients that I didn t fully understand before as you need to read the docs and experiment So what do you think Could this actually become something useful Can you imagine generating super light weight code snippets for documentation as part of the build step and just serving CSS and a single element Although it is a joke project right now could the concept actually work in production Let me know what you think in the comments |
2023-08-16 11:45:23 |
海外TECH |
DEV Community |
Data Structures and Algorithms: Big O Notation |
https://dev.to/purity_gwaro/data-structures-and-algorithms-big-o-notation-1m3b
|
Data Structures and Algorithms Big O Notation IntroBig O Notation is a way to formalize fuzzy counting It allows us to talk formally about how the runtime of an algorithm grows as the inputs grow It is used to analyze the performance of an algorithm A good performing algorithm is fasteroccupies less memory during its operationis readableIn Big O we majorly concentrate on Time ComplexitySpace Complexity Time ComplexityThis is the number of operations the computer has to perform during the execution of an algorithm This remains constant no matter what computer we are on function addUpTo n return n n The above function has operations and whether the input is or function addUpTo n let total for let i i lt n i total return total This second function on the other hand has these operations from the first to the last if you consider n to be total let i lt n i lt n three times i three times total three times Now consider an input like n those will be times more operations in the for loop Given the examples above the way Big O Notation is represented for the scenarios is as follows constant operations O no of operations remains the same despite the input valueinconsistent no of operations O n no of operations increases as the input value increasesfor a for loop inside another for loop O n n Space ComplexityThe space that an algorithm takes up as the size of the input increases When we talk about space complexity we mostly refer to Auxiliary Space Complexity which refers to the space required by the algorithm not including space taken up by the inputs Rules of ThumbMost primitives boolean numbers undefined null are constant space Strings require O n space where n is the string length Reference types are generally O n where n is the length for arrays or the number of keys for objects Example function addUpTo n let total for let i i lt n i total return total Here we have two variables taking up space while the algorithm executes total and i Regardless of the size of the input there will always be two spaces used hence the function above represents O space complexity Example function double arr let newArr for let i i lt arr length i newArr push arr i return newArr This function on the other hand is O n since the array length grows hence more space occupied depending on the items in the input array LogarithmsSometimes Big O expressions involve more complex mathematical expressions i e logarithms A logarithm is the inverse of exponentiation Just like division and multiplication are a pair the two are The logarithm of a number roughly measures the number of times you can divide that number by before you get a value that s less than or equal to Importance of Logarithms in Big OCertain Searching Algorithms have Logarithmic Time ComplexityEfficient Sorting Algorithms involve LogarithmsRecursion sometimes involves Logarithmic Space Complexity Analyzing Performance of Arrays and Objects in the lense of Big O Notation ObjectsThey are unordered key value pairsThey work well when You don t need orderYou need fast access insertion and removal Big O of ObjectsInsertion O Removal O Searching O n Access O Big O of Object MethodsObjects keys O n Objects values O n Objects entries O n hasOwnProperty O ArraysThese are ordered listsThey work well when You need orderYou need fast access insertion and removal Big O of ArraysInsertion depends on where we are inserting end O beginning O n Removal depends on where we are removing end O beginning O n Searching O n Access O Big O of Array Methodspush O pop O shift O n unshift O n concat O n slice O n sort O n log n for each map filter reduce O n |
2023-08-16 11:09:03 |
Apple |
AppleInsider - Frontpage News |
Crash Detection guides help to critically-injured driver |
https://appleinsider.com/articles/23/08/16/crash-detection-guides-help-to-critically-injured-driver?utm_medium=rss
|
Crash Detection guides help to critically injured driverFollowing an accident in Ontario the iPhone Crash Detection feature immediately alerted first responders leading to the severely injured driver being airlifted to hospital Crash Detection can alert emergency servicesSince Crash Detection was launched with the iPhone it has brought help to countless drivers and police to fatalities According to the South Grey News it is now also responsible for alerting first responders to a serious accident long before it could have been detected any other way Read more |
2023-08-16 11:34:21 |
海外TECH |
Engadget |
Scientists recreate an iconic Pink Floyd song by scanning listeners' brains |
https://www.engadget.com/scientists-recreate-an-iconic-pink-floyd-song-by-scanning-listeners-brains-114053359.html?src=rss
|
Scientists recreate an iconic Pink Floyd song by scanning listeners x brainsYou know when a certain song comes on and it encompasses your whole being for a few minutes Music has a way of causing a unique and engaging stimulation in your brain one that scientists are working to understand and mimic Such was the case in a recent study published in PLOS Biology in which researchers successfully implemented technology that recreated Pink Floyd s Another Brick in the Wall Part solely using brain activity It utilized a technique known as stimulus reconstruction and built on previous innovations allowing researchers to recreate a song akin to the one a person had heard The participants had pharmacoresistant epilepsy and intracranial grids or strips of electrodes which had been surgically implanted to aid in their treatment Researchers utilized these electrodes to record activity across multiple auditory regions of the individuals brains that process aspects of music like lyrics and harmony ーwhile the participants actively listened to Another Brick in the Wall Part The entirety of the recordings took place at Albany Medical Center in upstate New York Scientists used AI to analyze then create a copy of the words and sounds participants had heard Though the final product was quite muffled but the song is clear to anyone listening so you can check it out for yourselfa The researchers are also confident that they could increase its quality in future attempts The listening experience primarily engaged the right side of participants brains mostly in the superior temporal gyrus and especially when absorbing unique music There was also a small level of stimulation in the left side of the brain Researchers further found that a point in the brain s temporal lobe ignited when the th notes of the rhythm guitar played while the song played at beats per minute nbsp This finding could provide more insight into the part that area plays in processing rhythm It could also aid in restoring people who have lost their speech ability through conditions like amyotrophic lateral sclerosis ALS Instead of creating a monotone almost robot like response better understanding the way a brain processes and responds to music might lead to more fluid prosthetics for speech This article originally appeared on Engadget at |
2023-08-16 11:40:53 |
海外TECH |
Engadget |
The Morning After: Tesla offers cheaper Model S and Model X options with shorter range |
https://www.engadget.com/the-morning-after-tesla-offers-cheaper-model-s-and-model-x-options-with-shorter-range-111540531.html?src=rss
|
The Morning After Tesla offers cheaper Model S and Model X options with shorter rangeTesla has quietly launched new much cheaper Model S and X variants with a shorter quoted range Standard Range Teslas are around less than the base model but with ranges cut by and miles respectively Both cars are half a second slower to so you might expect your overall responsiveness to drop as well It s not clear if the vehicles are the base models with some of the capacity software locked or if there s really a much smaller battery under the floor It s also not clear when development work began on the models but at the end of July Reuters suggested Tesla had overstated its range figures especially when its EVs are fully charged It said the vehicles would only report honest range targets when the battery had fallen to percent at which point the numbers would fall dramatically And that Tesla had a team set up in Las Vegas to deflect user queries about diminished range when they tried to arrange a service appointment That report has already triggered the start of a class action lawsuit in California accusing the company of fraud ーDan CooperYou can get these reports delivered daily direct to your inbox Subscribe right here The biggest stories you might have missed Batman Arkham Trilogy is coming to Nintendo Switch on October Google Photos update improves Memories view with generative AI Google s latest AI trick is summarizing long web pages Logitech s Litra Glow streaming light drops back down to YouTube Music debuts Samples a TikTok style feed for music discoveryThe legal loophole that lets the government search your phone Astronomers confirm Maisie s galaxy is one of the oldest observedLamborghini teases a fully electric supercar ahead of its August revealIt looks pretty shrouded in shadow Lamborghini On August Lamborghini is expected to unveil its first all electric super hyper mega car concept Ahead of the event the company has dropped this teaser showing off the very clean lines of the model Details are scarce but we do know it ll be an entirely new vehicle rather than an electrified version of an existing whip You ll have time to save up to buy one we re not expected to see a road ready version for several years Continue Reading Xbox adopts an strike suspension policyIt s clarified and expanded how it enforces community standards Photo by Aaron Souppouris EngadgetMicrosoft s updated Xbox community standards have moved to an eight strike policy Minor infringements will get day long suspensions from Xbox social features while the gaming giant will ban repeated and persistent rule breakers for a whole year Users will also be able to see their enforcement history to make sure the process is transparent Continue Reading Comcast debuts Storm Ready WiFi device ahead of hurricane seasonStay connected when the power s out Comcast has launched Storm Ready WiFi a backup connection device that uses cellular data to keep you connected when things get rough The battery powered unit will run for up to four hours on a charge twice as long as the average US power cut It s available to select Xfinity users for a month and might be useful come hurricane season Continue Reading The best DACs for Apple Music Lossless in Get HiFi audio on the go Photo by James Trew EngadgetApple s belated embrace of high resolution audio means there s a lot more interest in how to get the best out of their audio service Sound expert James Trew has put together this guide of the best DACs that deliver crisp audio both at home and on the go He s also added options that work well with Qobuz Tidal and Deezer if those are where your musical loyalties lie Continue Reading X is slowing down links to websites Elon Musk has publicly feuded withBecause of course it has Xwitter appears to be intentionally slowing outbound links to rival platforms and organizations its founder doesn t like In recent days users clicking links to The New York Times Mastodon Bluesky Threads and Substack have been delayed by five seconds before going through The list of targets and the consistency at which the delay is applied suggests it s a deliberate attempt to sandbag the targets of Musk s ire Continue Reading This article originally appeared on Engadget at |
2023-08-16 11:15:40 |
ニュース |
BBC News - Home |
UK rents rise to highest rates since 2016 |
https://www.bbc.co.uk/news/business-66521015?at_medium=RSS&at_campaign=KARANGA
|
prices |
2023-08-16 11:55:10 |
ニュース |
BBC News - Home |
Ukraine war: Ship leaves Odesa amid Russia Black Sea attack fears |
https://www.bbc.co.uk/news/world-europe-66518504?at_medium=RSS&at_campaign=KARANGA
|
odesa |
2023-08-16 11:41:54 |
ニュース |
BBC News - Home |
Jail for teenager who murdered boy at Glasgow railway station |
https://www.bbc.co.uk/news/uk-scotland-glasgow-west-66520511?at_medium=RSS&at_campaign=KARANGA
|
glasgow |
2023-08-16 11:45:15 |
ニュース |
BBC News - Home |
Australia 1-3 England: Lionesses reach first Women's World Cup final |
https://www.bbc.co.uk/sport/football/66499185?at_medium=RSS&at_campaign=KARANGA
|
Australia England Lionesses reach first Women x s World Cup finalEngland spoil co hosts Australia s party by booking their place in the Women s World Cup final for the first time on a historic night in Sydney |
2023-08-16 11:53:42 |
ニュース |
BBC News - Home |
Women's World Cup: Lauren Hemp restores England lead in semi-final against Australia |
https://www.bbc.co.uk/sport/av/football/66520773?at_medium=RSS&at_campaign=KARANGA
|
Women x s World Cup Lauren Hemp restores England lead in semi final against AustraliaLauren Hemp gets in between two defenders to restore England s lead against Australia in their Women s World Cup semi final |
2023-08-16 11:41:03 |
ニュース |
BBC News - Home |
Women's World Cup: Sam Kerr scores incredible equaliser for Australia against England |
https://www.bbc.co.uk/sport/av/football/66520769?at_medium=RSS&at_campaign=KARANGA
|
Women x s World Cup Sam Kerr scores incredible equaliser for Australia against EnglandAustralia s Sam Kerr scores an incredible equaliser in their Women s World Cup semi final against England in Sydney |
2023-08-16 11:30:16 |
IT |
週刊アスキー |
スーツ10種類追加!『エグゾプライマル』無料タイトルアップデート第1弾が配信中 |
https://weekly.ascii.jp/elem/000/004/150/4150107/
|
配信中 |
2023-08-16 20:50:00 |
コメント
コメントを投稿