Skip to content

Instantly share code, notes, and snippets.

View dgdavid's full-sized avatar

David Díaz dgdavid

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 26, 2024 05:24
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@krisleech
krisleech / renew-gpgkey.md
Last active April 22, 2024 20:13
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@shundhammer
shundhammer / autodocs-github-pages.md
Last active January 24, 2024 21:52
Doxygen-Autodocs on GitHub Pages

Doxygen-Generated Autodocs on GitHub Pages

General Idea

GitHub offers hosting documentation on GitHub Pages. This can be done once for each GitHub user, for each GitHub organization, for each GitHub project.

If the process for building the autodocs is already in place (as is the case for libyui), it is just a matter of generating them, moving them to the right place, and deploying them to the project's GitHub Pages.

It can be difficult to test the different scenarious for a module intended for use by including in another class.

If the class is statically defined in the spec, any later definitions extend, not replace, the first definition - which can cause test issues and breaks isolation between examples.

RSpec.describe SomeModule do
  class SomeIncluder
    include SomeModule
  end
 
@minac
minac / recommendationsforportugal.md
Last active March 26, 2019 11:05
Recommendations for Portugal

Recommendations for Portugal

Carly and I are fortunate enough to know people from different parts of the World. Since Portugal and specifically Porto became famous in the tourist circuit we keep getting asked for recommendations, so we joined together a bunch of things we had written to different friends and make it a blog post so that it's easily shareable. We hope it is useful for you. If you like it then (shameless plug), consider coming on one of our food tours in Porto to get to know the local culture through food and wine with amazing guides.

DISCLAIMER: This is Carly and Miguel's research and opinion, not Taste Porto's, nor any formal guidebooks. Different people think and prefer different things, so proceed as you will.

Portugal sea and surf

The sea/ocean off the western coast of Portugal is cold year round, the Atlantic has no warm currents here, and there is a frequent nortada (north wind) which makes swimming quite cold. The positive side of it is that

@backpackerhh
backpackerhh / inflections.rb
Last active September 18, 2017 10:24
Inflections
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
inflect.plural /(or)$/i, '\1es'