Skip to content

Instantly share code, notes, and snippets.

View kes3583's full-sized avatar
๐ŸŽฏ
Focusing

blossom kes3583

๐ŸŽฏ
Focusing
  • Seoul
View GitHub Profile
@kes3583
kes3583 / filterArray.js
Created March 6, 2023 09:37 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@kes3583
kes3583 / gist:f969c5498719ec6012a6d68a671403d6
Last active July 7, 2021 01:36
CSS - [attribute="value"] Selector , Form
- a ํƒœ๊ทธ์— target attibute๋งŒ ์„ ํƒ
a[target] {
background-color: yellow;
}
- title attibute ์— flower value๊ฐ’๋งŒ ์„ ํƒ
[title~=flower] {
border: 5px solid yellow;
}
@kes3583
kes3583 / gist:9962ee2ef20d749f72be60548b8c5961
Last active May 17, 2021 08:45
Javascript - on mobile screen - apply touch (pressed) with Pseudo class :active
1. IOS - css ๋กœ ์ˆ˜์ •ํ•˜๋ฉด?
-webkit-tap-highlight-color:
2. ์•ˆ๋“œ๋กœ์ด๋“œ์™€ ๊ฐ™์ด ์ˆ˜์ •ํ•˜๋ ค๋ฉด ?
- a:active ์ ์šฉ
- ์‹คํ—˜๊ฒฐ๊ณผ ์•„์ดํŒจ๋“œ์—์„œ๋Š” a:hover , a:active๊ฐ€ ๊ฐ™์ด ์ ์šฉ๋œ๋‹ค.
- button ์ ์šฉ : https://codepen.io/Tkashiro/full/EaVVxr
the best way to order your pseudo-class styles are :hover then :focus then :active .
@kes3583
kes3583 / gist:89dd011e48fa212ccc8a8d55ddad4a53
Last active May 7, 2021 10:15
Javascript - How to add an event listener to multiple elements in JavaScript
1. ForEach
let btns = document.querySelectorAll('button');
btns.forEach(function (i) {
i.addEventListener('click', function() {
console.log(i);
});
});
@kes3583
kes3583 / gist:657a5aff48ac4e2cbf51c26f37d6b315
Created March 17, 2021 03:06
css border radius + linear-gradient together
button {
width: 160px;
height: 40px;
font-size: 15px;
letter-spacing: -1px;
line-height: 21px;
color: #2a5081;
vertical-align: middle;
}
@kes3583
kes3583 / gist:648fa267c39647a077b6fe09439a6c4c
Created February 15, 2021 13:42
logical OR (||) operator
return code || ''
code ๊ฐ€ true ์ด๋ฉด code ์ถœ๋ ฅ ์•„๋‹ˆ๋ฉด '' (๋นˆ์นธ์ถœ๋ ฅ)
์ด๋Ÿด๋•Œ code๊ฐ€ false ์ผ ๊ฒฝ์šฐ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค
Examples of expressions that can be converted to false are:
null;
NaN;
0;
empty string ("" or '' or ``);
@kes3583
kes3583 / gist:6b30762f4257c6b5b8c85a3ed1173cbc
Created December 2, 2020 09:01
javascript - Page: DOMContentLoaded, load, beforeunload, unload
https://javascript.info/onload-ondomcontentloaded
@kes3583
kes3583 / gist:b66a07df80137dd07c880b8d9693be6a
Created September 2, 2020 10:03
Javascript - object toString()
var book = {
title:"๊ฐ์ฒด์ง€ํ–ฅ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ"
}
var message = "Book = " + book;
console.log(book.toString())
console.log(message) // "Book = [object Object]"
console.log(Object.prototype.toString.call(book))
var book2 = {
title:"๊ฐ์ฒด์ง€ํ–ฅ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ",
@kes3583
kes3583 / gist:40a78871ad2cbd342312ce8f418bf8c5
Created August 29, 2020 11:52
HTML - createDocumentFragment vs createElement
1. DocumentFragments are DOM Node objects which are never part of the main DOM tree.
var ul = document.getElementById("ul_test");
// First. add a document fragment:
#javascript
(function() {
@kes3583
kes3583 / gist:26551227712048b98fde98f98bdeb10f
Created August 12, 2020 04:39
CSS - ํ…์ŠคํŠธ ๋ง์ค„์ž„ํ‘œ ํ‘œ์ถœ
display: -webkit-box; -webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;