Skip to content

Instantly share code, notes, and snippets.

View fysherman's full-sized avatar
🍒
cherry

Duy Khanh Bui fysherman

🍒
cherry
  • Viet Nam
  • 13:54 (UTC +07:00)
View GitHub Profile
@fysherman
fysherman / set-caret-end-of-contenteditable.js
Created December 16, 2021 04:14
Set caret end of contenteditable element
function setCaretEndOfElement(element) {
if(document.createRange === undefined || window.getSelection === undefined) return;
const range = document.createRange();
const selection = window.getSelection();
range.selectNodeContents(element);
range.collapse(false);
selection!.removeAllRanges();
@fysherman
fysherman / fedora_folder_lock_icon.txt
Created February 25, 2022 08:51
Linux Fedora folder lock icon
sudo chown -R $USER: $HOME
@fysherman
fysherman / vite-scss-variable-import.js
Created March 19, 2022 09:29
Vite's global scss variable config
export default {
css: {
preprocessorOptions: {
scss: {
// example : additionalData: `@import "./src/design/styles/variables";`
// dont need include file extend .scss
additionalData: `@import "./src/path-to-scss-variables";`
},
},
},
@fysherman
fysherman / _responsive.scss
Created March 23, 2022 15:24
Responsive mixins scss
@mixin screen($breakpoint) {
@if $breakpoint==xs {
@media screen and (max-width: 320px) {
@content;
}
}
@if $breakpoint==sm {
@media screen and (min-width: 576px) {
@content;
}
@-moz-document url-prefix() {
.selector {
color: lime;
}
}