Skip to content

Instantly share code, notes, and snippets.

View leegeunhyeok's full-sized avatar
🎯
Focusing

Geunhyeok LEE leegeunhyeok

🎯
Focusing
View GitHub Profile
@leegeunhyeok
leegeunhyeok / content.js
Created June 29, 2020 16:27
WWDC20 - Safari 14 Web Extension
(() => {
function getText (node) {
if (node.hasChildNodes()) {
node.childNodes.forEach(getText);
} else if (node.nodeType === Node.TEXT_NODE) {
if (node.textContent.includes("Apple")) {
node.textContent = node.textContent.replaceAll("Apple", "🍎");
}
}
}
@leegeunhyeok
leegeunhyeok / manifest.json
Created June 29, 2020 16:17
WWDC20 - Safari 14 Web Extension
{
"manifest_version": 2,
"default_locale": "en",
"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"version": "1.0",
"icons": {
"48": "images/icon-48.png",
@leegeunhyeok
leegeunhyeok / index.js
Last active July 13, 2023 14:51
πŸ”” Web Push - VAPID verification example
// VAPID - Voluntary Application Server Identification for Web Push
// Step-by-Step Verification example
/*
[[ Web Push Archtecture with VAPID verification ]]
@author leegeunhyeok <[email protected]>
[0]Has VAPID Key Pair
| [7]
@leegeunhyeok
leegeunhyeok / docker-api.sh
Created May 26, 2020 05:24
🐳 Using Docker Engine API via UNIX Socket
#!/bin/bash
# DOCS: https://docs.docker.com/engine/api/v1.40
# docker ps
curl --unix-socket /var/run/docker.sock http://localhost/v1.40/containers/json
#[
# {
# "Id": "d925cbb5c64aa03c3daf8492a75bdee9876725a3d3073abb8eb8b9316c90f392",
@leegeunhyeok
leegeunhyeok / I'm an early 🐀
Last active October 29, 2020 00:52
It's Coding Time!
🌞 Morning 849 commits β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 41.1%
πŸŒ† Daytime 600 commits β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 29.1%
πŸŒƒ Evening 17 commits ▏░░░░░░░░░░░░░░░░░░░░ 0.8%
πŸŒ™ Night 598 commits β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 29.0%
@leegeunhyeok
leegeunhyeok / main.js
Last active March 4, 2020 00:35
πŸ–– Vue.js 3 composition API
import Vue from 'vue'
import VueCompositionApi from '@vue/composition-api'
import App from './App.vue'
Vue.use(VueCompositionApi)
new Vue({
render: h => h(App)
}).$mount('#app')
@leegeunhyeok
leegeunhyeok / scope.js
Created February 24, 2020 05:46
What is self in Javascript?
// var myVariable = 10;
window.myVariable = 10;
function myFunc () {
console.log(myVariable);
}
// 10
myFunc();
@leegeunhyeok
leegeunhyeok / 04_self.js
Last active February 24, 2020 06:52
What is self in javascript?
// ...
// 1
function myFunc () {
var self = this;
$('#button').click(function () {
self.doSomething // this of myFunc
});
}
@leegeunhyeok
leegeunhyeok / 03_self.js
Last active February 24, 2020 04:41
What is self in javascript?
// In worker context
// 1. without self
addEventListener('message', event => {
// ...
});
// 2. with self
self.addEventListener('message', event => {
@leegeunhyeok
leegeunhyeok / 02_self.html
Last active February 24, 2020 07:15
What is self in javascript?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>self</title>
</head>
<body>
</body>
<script>