Skip to content

Instantly share code, notes, and snippets.

View dhkamp's full-sized avatar

David Hölkeskamp dhkamp

View GitHub Profile
@dhkamp
dhkamp / ie8-backgroundSize.css
Last active August 29, 2015 14:25
This css-snippet provides background-size functionality for IE8
/**
* Stretch a background-image to fill the parent in IE8.
* Similar to background-size: ...;
*/
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='PATH/TO/IMAGE.png', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='PATH/TO/IMAGE.png', sizingMethod='scale')";
/* styles for '...' */
.block-with-text {
/* hide text if it more than N lines */
overflow: hidden;
/* for set '...' in absolute position */
position: relative;
/* use this value to count block height */
line-height: 1.2em;
/* max-height = line-height (1.2) * lines max number (3) */
max-height: 3.6em;
@dhkamp
dhkamp / mocking_modules_in_jest.js
Last active September 27, 2019 13:42
Mocking modules in Jest
// utils/index.js
export const MagicNumber = 11;
// my-component.js
import Utils from '../utils/index.js';
export function doMagic() {
return 3 + Utils.MagicNumber;