This has been incorporated in a small library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = []; | |
document.querySelectorAll("body *") | |
.forEach(function(elem){ | |
if(elem.getBoundingClientRect().width > document.body.getBoundingClientRect().width){ | |
list.push(elem.outerHTML.split('>')[0] + '>'); | |
} | |
}); | |
confirm( "these elements are wider than the viewport:\n\n " + list.join("\n") ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$userPath = $env:USERPROFILE | |
$pathExclusions = New-Object System.Collections.ArrayList | |
$processExclusions = New-Object System.Collections.ArrayList | |
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null | |
$pathExclusions.Add('C:\Windows\assembly') > $null | |
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null | |
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null | |
$pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null | |
$pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Connect your mobile device via usb (just this once) | |
2) Establish a port with your mobile device using 'adb tcpip <port number>'. | |
eg. adb tcpip 5555 | |
3) Remove USB and 'adb connect <mobile device ip><above mentioned port number>' . | |
Eg . adb connect 192.160.0.124:5555 | |
4) 'React-native run-android' in your project folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tip: use with await. | |
// const preloaded = await preloadAll(['img1.jpg', 'img2.jpg']) | |
export const preload = src => new Promise((resolve, reject) => { | |
const img = new Image() | |
img.onload = resolve | |
img.onerror = reject | |
img.src = src | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import loadImage from 'loadImage' | |
const addImg = (src) => { | |
const imgEl = document.createElement('img') | |
imgEl.src = src | |
document.body.appendChild(imgEl) | |
} | |
const imgArr = [ | |
loadImage('images/cat1.jpg'), | |
loadImage('images/cat2.jpg'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const transitionToPromise = (el, property, value) => | |
new Promise(resolve => { | |
el.style[property] = value; | |
const transitionEnded = e => { | |
if (e.propertyName !== property) return; | |
el.removeEventListener('transitionend', transitionEnded); | |
resolve(); | |
} | |
el.addEventListener('transitionend', transitionEnded); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.
Everything is broken up by tag, but within each the selectors aren't particularly ordered.
I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A
A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:
-webkit-appearance:none;
NewerOlder