惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Latest news
Latest news
NISL@THU
NISL@THU
S
Security Affairs
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
AI
AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
I
InfoQ
Schneier on Security
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
IT之家
IT之家
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
L
LINUX DO - 最新话题
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
H
Heimdal Security Blog
S
SegmentFault 最新的问题

oida.dev | TypeScript, Rust

TypeScript's `erasableSyntaxOnly` Flag Unsafe for work Tokio: Macros Tokio: Channels Tokio: Getting Started Network Applications on the Tokio Stack Remake, Remodel, Reduce. The `never` type and error handling in TypeScript 5 Inconvenient Truths about TypeScript Refactoring in Rust: Introducing Traits Refactoring in Rust: Abstraction with the Newtype Pattern Announcing the TypeScript Cookbook TypeScript: Iterating over objects The road to universal JavaScript 10 years of oida.dev Rust: Tiny little traits The TypeScript converging point How not to learn TypeScript Getting started with Rust Introducing Slides and Coverage TypeScript: The humble function overload TypeScript + React: Children types are broken TypeScript: In defense of any Rust: Enums to wrap multiple errors Dissecting Deno Error handling in Rust TypeScript: Unexpected intersections Upgrading Node.js dependencies after a yarn audit TypeScript: Array.includes on narrow types TypeScript + React: Typing Generic forwardRefs shared, util, core: Schroedinger's module names Learning Rust and Go TypeScript: Narrow types in catch clauses TypeScript: Low maintenance types Tidy TypeScript: Name your generics Tidy TypeScript: Avoid traditional OOP patterns Tidy TypeScript: Prefer type aliases over interfaces Tidy TypeScript: Prefer union types over enums My new book: TypeScript in 50 Lessons Go Preact! ❤️ this in JavaScript and TypeScript TypeScript and ECMAScript Modules TypeScript + React: Why I don't use React.FC TypeScript + React: Component patterns TypeScript: Augmenting global and lib.dom.d.ts Vite with Preact and TypeScript TypeScript: Union to intersection type 11ty: Generate Twitter cards automatically Are large node module dependencies an issue? TypeScript: Variadic Tuple Types Preview TypeScript: Improving Object.keys Remake, Remodel. Part 4. TypeScript + React: Typing custom hooks with tuple types TypeScript: Assertion signatures and Object.defineProperty TypeScript: Check for object properties and narrow down type Boolean in JavaScript and TypeScript void in JavaScript and TypeScript Symbols in JavaScript and TypeScript Why I use TypeScript TypeScript + React: Extending JSX Elements TypeScript: Validate mapped types and const context TypeScript: Match the exact object shape TypeScript: The constructor interface pattern Streaming your Meetup - Part 4: Directing and Streaming with OBS Streaming your Meetup - Part 3: Speaker audio Streaming your Meetup - Part 2: Speaker video Streaming your Meetup - Part 1: Basics and Projector TypeScript and React Guide: Added a new styles chapter TypeScript and React Guide: Added a new render props chapter TypeScript and React: Styles and CSS TypeScript and React TypeScript and React Guide: Added a new prop types chapter TypeScript without TypeScript -- JSDoc superpowers TypeScript: Mapped types for type maps JAMStack vs serverless web apps The Unsung Benefits of JAMStack Sites TypeScript: Ambient modules for Webpack loaders My most favourite talks in 2018 TypeScript and React Guide: Added a new context chapter TypeScript: Built-in generic types TypeScript: Type predicates JSX is syntactic sugar TypeScript and React Guide: Added a new hooks chapter Getting your CfP application right FAQ on our Angular Connect Talk: Automating UI development TypeScript and Substitutability Debugging Node.js apps in TypeScript with Visual Studio Code From Medium: Deconfusing Pre- and Post-processing From Medium: PostCSS misconceptions Saving and scraping a website with Puppeteer Cutting the mustard - 2018 edition Wordpress as CMS for your JAMStack sites My most favourite podcast episodes in 2017 My most favourite talks in 2017 My most favourite books in 2017 The Best Request Is No Request, Revisited Not so hidden figures - Organizing ScriptConf My podcast journey to ScriptCast Grid layout, grid layout everywhere! #scriptconf and #devone
Great Scott! Five lesser known shortcuts for Emmet.io that rock!
2013-10-16 · via oida.dev | TypeScript, Rust

I'm a huge fan of Emmet. It allows you not only to create markup in no-time by using a CSS-like syntax in your most favourite code editor (e.g. ul>li*5 expands to one <ul> element with five nested <li> elements in HTML after hitting the tab key. Alternatively, you can just type m20 in your CSS to get margin: 20px after hitting tab).

If you don't have Emmet, check out the list of available plugins and install it right now. Or if you want to just give it a try Codepen also implements Emmet in their CSS and HTML views.

Here a the five shortcuts, that not only surprised me most, but also boosted my productivity up to eleven!

CSS: bxsd -- txs

I never can remember the values for both the box-shadow and text-shadow properties in CSS. I know them a little, but I always have to try it out first in dev tools. But if I type

bxsd

and hit the tab key, I get this snippet inserted in my CSS code:

-webkit-box-shadow: inset hoff voff blur color;
-moz-box-shadow: inset hoff voff blur color;
box-shadow: inset hoff voff blur color;

Wohoo! Just need to adapt the values (Sublime does multi-cursor, too) and I'm all done.

In Codepen, bxs does the same, just Sublime needs an extra d. SCNR.

Same goes for text-shadow. A simple

txs

expands to

text-shadow: hoff voff blur #000;

I don't use prefixed box-shadow anymore, but deleting lines is always a lot easier than typing each value on its own.

Update

The guys from Emmet told me via Twitter, that you can update your preferences to disable certain prefixes. Thank you, guys!

HTML: lorem

You know what

p*5>lorem

does? Exactly that. It inserts five paragraphs of Lorem Ipsum.

p*5>ipsum

does the same. You know that Lorem Ipsum is fucking evil, and I'm absolutely behind that. But to check if your design holds a massive amount of text, there's no easier way to do that.

If you just need it every once in a while, type lorem or ipsum to get just one paragraph.

CSS: bz

box-sizing is at the moment the only CSS property that I still prefix. It's mostly (I even think just) used for layout tasks, and leaving it unprefixed would cause issues on older Android browsers. Writing all prefixed properties is cumbersome, so before using Emmet, I included a little Sass mixing that came with Bootstrap:

@mixin box-sizing($val: border-box) {
    -webkit-box-sizing: $val;
    -moz-box-sizing: $val;
    box-sizing: $val;
}

to use with:

@include box-sizing();

It's okay, but I always find mixins kinda laborious, especially if they just prefix stuff. Emmet knows, that if you want to add box-sizing in your CSS, you might just have one and only one desire: Set it to border-box for all available platforms. So if you type:

bz

it expands to

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

after hitting the tab key. Great, all I need and just by typing two letters!

CSS: lg()

Another thing that I always used a mixin for was linear gradients. Mostly because specification changed over and over, and after having almost the same implementation across all platforms, the very first value describing the direction got changed by a W3C specification. If you know German, check out buddy Peter's cents on that topic. Anyhow, I never gave much ado about it, and mostly used a tool or a mixin for that task.

But with lg in Emmet, everything seems so much, much easier.

Typing

lg(left, #bada55 60%, #c0ffee)

and hitting tab, results in

background-image: -webkit-gradient(linear, 0 0, 100% 0,
  color-stop(0.6, #bada55), to(#c0ffee));
background-image: -webkit-linear-gradient(left, #bada55 60%, #c0ffee 100%);
background-image: -moz-linear-gradient(left, #bada55 60%, #c0ffee 100%);
background-image: -o-linear-gradient(left, #bada55 60%, #c0ffee 100%);
background-image: linear-gradient(left, #bada55 60%, #c0ffee 100%);

This does not include the W3C proposed specification, well, at least yet. But I think it will be in a future update. For know, it works, at least for me.

HTML: !

My most favourite of all is the ! shortcut. I found it especially tedious to create the basic HTML structure, so i used a lot of HTML boilerplate code and created some snippets for sublime. Emmet just needs a little

!

at the start of a line in your HTML, and you get this:


<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
</html>

with the cursor pointing to the start of the <title> tag (which is by the way the thing I forget most when creating new sites). This is heavy!

Also interesting

If you want to have a complete overview of available Emmet shortcuts, be sure to check out there cheat sheet

Image: Wikipedia

Related Articles