This file contains hidden or 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 Search Anywhere | |
| // @namespace http://tampermonkey.net/ | |
| // @version INITIAL | |
| // @description Press Alt+D to activate search function within a webpage, Press Alt+D,D(Double Tap) for default browser behavior. | |
| // @author tez | |
| // @include http://*/* | |
| // @include https://*/* | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or 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 testFizzBuzz = (fizzbuzz) => { | |
| const assert = (value) => { | |
| if (value === true) { | |
| return; | |
| } else { | |
| throw 'Assertion failed'; | |
| } | |
| }; | |
| const input = [ ...Array(15).keys() ].map(e=>e+1); |
This file contains hidden or 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
| import java.io.UnsupportedEncodingException; | |
| import java.util.AbstractMap; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| public class ValueExample { |
This file contains hidden or 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.util; | |
| import java.util.List; | |
| import org.apache.ibatis.session.RowBounds; | |
| import lombok.Getter; | |
| import lombok.Setter; | |
| @Getter | |
| @Setter | |
| public class Pagination<T> { |
This file contains hidden or 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
| let com = Math.random()*3 | 0 | |
| let usr | |
| const rps = 'rock paper scissors'.split(' ') | |
| const score = 'draw win lose'.split(' ') | |
| let usrNum | |
| while ((usrNum = rps.indexOf(usr = prompt('choose your move'))) === -1) { | |
| alert('invalid move') |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
OlderNewer