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
// ==UserScript== | |
// @name SO copy code snippet | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Adds copy button to code snippets | |
// @author me | |
// @match https://stackoverflow.com/questions/* | |
// @icon https://www.google.com/s2/favicons?domain=stackoverflow.com&sz=64 | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/cash/8.1.1/cash.min.js |
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
// ==UserScript== | |
// @name Ctrl+Enter executes for programmers.co.kr | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://school.programmers.co.kr/learn/courses/*/lessons/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=programmers.co.kr | |
// @grant none | |
// ==/UserScript== |
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 deepEqual(a, b) { | |
// Handle edge cases and primitives using Object.is | |
if (Object.is(a, b)) return true; | |
// Handle arrays | |
const isArray = Array.isArray(a) && Array.isArray(b); | |
const isTypedArray = ArrayBuffer.isView(a) && ArrayBuffer.isView(b); | |
if (isArray || isTypedArray) { | |
if (isTypedArray) { | |
// Check if both are of the same type |
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 | |
# Environment check | |
# If migrating from localhost, set this to localhost | |
if [[ ! $SOURCE_HOST_ADDRESS ]] | |
then | |
echo "Please set the current host address in SOURCE_HOST_ADDRESS" | |
exit 1 | |
fi |
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
canon_map = { | |
"a": ["Ã", "å", "Ă", "ą", "ƛ", "ǟ", "ɑ", "Δ", "Λ", "ά", "α", "λ", "Д", "а", "Թ", "ค", "მ", "ል", "Ꭿ", "Ꮧ", "ᕱ", "ᗅ", "ᗩ", "ᴀ", "ᴬ", "ᵃ", "ₐ", "₳", "⍺", "ⓐ", "卂", "ꁲ", "ꋫ", "ꋬ", "ꍏ", "ꪖ", "a", "ム", "𝐚", "𝑎", "𝒂", "𝒶", "𝓪", "𝔞", "𝕒", "𝖆", "𝖺", "𝗮", "𝘢", "𝙖", "𝚊", "𝛂", "𝛼", "𝜶", "𝝰", "𝞪", "🄰", "🅐", "🅰", "🇦\u200c",], | |
"b": ["ß", "Ɓ", "Ƅ", "ɓ", "ɮ", "ʙ", "β", "ϐ", "Ϧ", "Б", "Ь", "б", "в", "ҍ", "Յ", "฿", "๒", "๖", "Ⴆ", "ჩ", "ც", "ጌ", "Ꮟ", "Ᏸ", "ᑲ", "ᖯ", "ᗷ", "ᙘ", "᥇", "ᴮ", "ᵇ", "ⓑ", "♭", "乃", "ꃃ", "ꃲ", "ꃳ", "ꋰ", "ꌃ", "ꍗ", "ꪉ", "b", "𐒈", "𝐛", "𝑏", "𝒃", "𝒷", "𝓫", "𝔟", "𝕓", "𝖇", "𝖻", "𝗯", "𝘣", "𝙗", "𝚋", "🄱", "🅑", "🅱", "🇧\u200c",], | |
"c": ["¢", "ç", "Ć", "Č", "Ƈ", "ƈ", "ȼ", "ς", "ϲ", "с", "Շ", "८", "૮", "ე", "ᄃ", "ር", "ፈ", "Ꮯ", "Ꮳ", "ᑕ", "ᑢ", "ᑤ", "ᝯ", "ᥴ", "ᨶ", "ᴄ", "ᶜ", "₡", "₵", "ℂ", "ⅽ", "ⓒ", "☾", "ⲥ", "ㄈ", "匚", "ꀯ", "ꇃ", "ꉓ", "ꉔ", "ꏳ", "ꏸ", "꒝", "ꮯ", "c", "𐐽", "𐒨", "𝐜", "𝑐", "𝒄", "𝒸", "𝓬", "𝔠", "𝕔", "𝖈", "𝖼", "𝗰", "𝘤", "𝙘", "𝚌", "🄲", "🅒", "🅲", "🇨\u200c",], | |
"d": ["Ð", "Ď", "ď", "Đ", "Ɗ", " |
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 time import sleep, time | |
import os | |
def binary_search(condition, low, high): | |
if callable(condition) and high > low: | |
mid = int((high + low) / 2) | |
res = condition(mid) |
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
package kr.co.benew.iddle_admin.servlet; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.function.BiFunction; | |
import java.util.function.UnaryOperator; | |
import javax.servlet.ServletResponse; | |
import javax.servlet.http.HttpServletResponse; |
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 json_format = (jsons, level = 2) => { | |
let i = 0 | |
return JSON.stringify(JSON.parse(jsons)).replace(/\[\]|\{\}|[{[,\]}]/g, | |
c => ['[]', '{}'].includes(c) ? c : '{[,'.includes(c) ? c + '\n' + (','.includes(c) ? ' '.repeat(i * level) : ' '.repeat(++i * level)) : '\n' + ' '.repeat(--i * level) + c) | |
.replace(/"(?:[^"]|\\")+"(:)/g, '$& ') | |
} |
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 iterateNode = (rootNode, [attrVisitor, textVisitor]) => { | |
if (rootNode instanceof Node) { | |
for(const node of rootNode.childNodes) { | |
if (node instanceof Element) { | |
for (const attr of node.attributes) { | |
attrVisitor.call(null, attr) | |
} | |
iterateNode(node, [attrVisitor, textVisitor]) | |
} else if (node instanceof Text) { | |
textVisitor.call(null, node) |
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 interceptFunction = (object, fnName, options) => { | |
const noop = () => {} | |
const fnToWrap = object[fnName] | |
const before = options.before || noop | |
const after = options.after || noop | |
object[fnName] = function (...args) { | |
before.apply(this, args) | |
const result = fnToWrap.apply(this, args) | |
after.apply(this, args, result) |
NewerOlder