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 html = [ | |
'<div>', | |
<span class="monster">ahoj</span>, | |
'</div>' | |
].join(''); |
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
function getPosition(elm) { | |
var xPos = 0, yPos = 0; | |
while(elm) { | |
xPos += (elm.offsetLeft - elm.scrollLeft + elm.clientLeft); | |
yPos += (elm.offsetTop - elm.scrollTop + elm.clientTop); | |
elm = elm.offsetParent; | |
} | |
return { x: xPos, y: yPos }; |
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
.ellipsis { | |
width: whatever; | |
text-overflow: ellipsis; | |
white-space: nowrap; | |
overflow: hidden; | |
} |
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
(function() { | |
let textNode, elm, | |
textWrapper = document.getElementById('content'), | |
text = [...textWrapper.textContent]; | |
// clear content of the node | |
while(textWrapper.hasChildNodes()) { | |
textWrapper.removeChild(textWrapper.lastChild); | |
} | |
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
### Terminal Syntax Highlighting | |
# Setup: "brew install highlight" | |
# Pipe Highlight to less | |
export LESSOPEN="| $(which highlight) %s --out-format xterm256 --line-numbers --quiet --force --style solarized-light" | |
export LESS=" -R" | |
alias less='less -m -N -g -i -J --line-numbers --underline-special' | |
alias more='less' |
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
~"calc(100% - @{variable})"; | |
// or | |
calc(100% ~"-" @variable); |
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 angle = (x, y) => { | |
let result = Math.atan(y / x); | |
if (x < 0) { | |
result += Math.PI; | |
} else if (y < 0) { | |
result += 2 * Math.PI; | |
} | |
return result; | |
}; |
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
git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
-p (with commit changes) | |
--graph (displayed as graph) | |
via Filipe Kiss |
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
document.documentElement.webkitRequestFullScreen(); |
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
touch ~/.android/repositories.cfg | |
brew cask install caskroom/versions/java8 | |
brew cask install android-sdk | |
brew cask install intel-haxm | |
brew install qt | |
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk" | |
sdkmanager "platform-tools" "platforms;android-27" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;27.0.0" "system-images;android-27;google_apis;x86" "emulator" | |
avdmanager create avd -n test -k "system-images;android-27;google_apis;x86" --tag google_apis | |
/usr/local/share/android-sdk/tools/emulator -avd test |
OlderNewer