Skip to content

Instantly share code, notes, and snippets.

Avatar
🚜
Working

Egor Stronhin egor-xyz

🚜
Working
View GitHub Profile
@dbox
dbox / Adobe-ask-experts.md
Last active Oct 31, 2016
Answer for adobe ask the experts
View Adobe-ask-experts.md

Q: What is your favorite Css 'trick'?

Responsive images in CSS are pretty easy: just set the width: 100% and height: auto and you're good to go. Things get a little unpredictable, though, when dealing with background images. Since putting a height on the element causes lots of responsive headaches, one workaround is to have the container scale by its aspect ratio. This can be achieved by setting a few attributes to the element's :after tag:

.my-element {
  overflow: hidden;
  position: relative;
}
.my-element:after {
  content: "";
@nolanlawson
nolanlawson / protips.js
Last active Nov 16, 2020
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@tuanlongn
tuanlongn / string.prototype.format.js
Last active Nov 27, 2018
Javascript: format string same as sprintf on C/PHP
View string.prototype.format.js
// format string same as sprintf on C/PHP
String.prototype.format = function() {
var str = this;
for (var i in arguments) {
str = str.replace('{' + i + '}', arguments[i]);
}
return str;
}
// usage:
@tahirm
tahirm / getDomainName.js
Last active Nov 27, 2018
Get complete domain name with protocol and port if available. #js #url From http://stackoverflow.com/questions/6941533/javascript-get-protocol-domain-and-port-from-url
View getDomainName.js
var domain = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : '');
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active Dec 4, 2020
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

You can’t perform that action at this time.