Skip to content

Instantly share code, notes, and snippets.

@yoavweiss
yoavweiss / Remap_esc_key.sh
Created October 7, 2018 20:14
Remap § to Esc and Esc to F24
#!/bin/bash
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}, {"HIDKeyboardModifierMappingSrc":0x700000029,"HIDKeyboardModifierMappingDst":0x700000073}]}'
@yoavweiss
yoavweiss / preload_feature_detection.js
Last active July 24, 2020 19:31
Preload feature detection
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@yoavweiss
yoavweiss / domtokenlist_feature_detection.js
Last active January 10, 2020 17:36
DOMTokenList supports() example
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
<picture>
<source srcset="http://placehold.it/300.png">
<img src="http://placehold.it/100.png" id=bla>
</picture>
<script>
(function() {
var img = document.getElementById("bla");
img.parentNode.removeChild(img);
})();
</script>
@yoavweiss
yoavweiss / gist:2b6a5fdb991be72a1f79
Created December 3, 2015 17:12
DOMTokenList feature detection
var tokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return false;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@yoavweiss
yoavweiss / dabblet.css
Last active August 29, 2015 14:20 — forked from LeaVerou/dabblet.css
Media query to detect full screen mode!
/**
* Media query to detect full screen mode!
* Y U NO WORK Chrome??
* Firefox, you’re lovely.
*/
body {
background: red;
font: bold 400% Helvetica Neue, sans-serif;
color: white;
@yoavweiss
yoavweiss / gist:cc867d5e63c1132c6cd3
Last active October 6, 2015 20:31
Responsive images links

Official RICG Web sites

Articles explaining the various use-cases and solutions:

@yoavweiss
yoavweiss / gist:10023162
Created April 7, 2014 16:03
sizes test cases
TestCase testCases[] = {
24 {"screen", 300},
25 {"(min-width:500px)", 300},
26 {"(min-width:500px) 200px", 200},
27 {"(min-width:500px) 200px, 400px", 200},
28 {"(min-width:5000px) 200px, 400px", 400},
29 {"(blalbadfsdf) 200px, 400px", 400},
30 {0, 0} // Do not remove the terminator line.
31 };
@yoavweiss
yoavweiss / gist:5793495
Created June 16, 2013 21:28
Responsive Web sites from @rwd's twitter stream
http://responsivedesignworkflow.com/
https://www.rijksmuseum.nl/en/explore-the-collection/subjects/owls
http://www.julianabicycles.com/
http://metaframe.elliance.com/
http://purecss.io/
http://hellogeri.com/
http://2012.dconstruct.org/
http://www.moneydesktop.com/
http://thepaintdrop.com/
http://www.npr.org/blogs/thisisnpr/2013/05/08/180363048/see-a-new-npr-homepage-on-your-smartphone
@yoavweiss
yoavweiss / Sites using picturefill
Created May 12, 2013 20:27
Sites using picturefill to implement art-direction
alistapart.com
animoto.com
behance.net
cato.org
ceskatelevize.cz
creativemarket.com
dribbble.com
evernote.com
extra.cz
flavorwire.com