Skip to content

Instantly share code, notes, and snippets.

View 5pecia1's full-sized avatar
πŸ˜€
Rustaceans

sol 5pecia1

πŸ˜€
Rustaceans
View GitHub Profile
@5pecia1
5pecia1 / dodo_fighter_agent.py
Created August 18, 2018 12:22 — forked from segfault87/dodo_fighter_agent.py
도도 νŒŒμ΄ν„°(https://pycon-2018-dodo-fighter.spoqa.com) μ—μ΄μ „νŠΈ 예제 μ½”λ“œ
import json
import sys
# 도도 νŒŒμ΄ν„°μ— μ°Έκ°€ν•˜κΈ° μœ„ν•΄μ„œλŠ” μ—μ΄μ „νŠΈλ₯Ό λ§Œλ“€μ–΄μ„œ μ œμΆœν•΄ μ£Όμ…”μ•Ό ν•©λ‹ˆλ‹€.
# μ—μ΄μ „νŠΈλŠ” μ‚¬μš©μžκ°€ μž‘μ„±ν•˜λŠ” 인곡지λŠ₯ μ½”λ“œλ‘œμ„œ, μ£Όμ–΄μ§€λŠ” ν˜„μž¬ κ²Œμž„ μƒνƒœλ₯Ό λ°”νƒ•μœΌλ‘œ
# μ–΄λ–€ μ•‘μ…˜μ„ μ·¨ν• μ§€λ₯Ό κ²°μ •ν•˜λŠ” 역할을 ν•©λ‹ˆλ‹€.
#
# μ•‘μ…˜ μ„€λͺ…
# - idle - 아무것도 ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.
# - forward - μ•žμœΌλ‘œ μ›€μ§μž…λ‹ˆλ‹€. μƒλŒ€κ°€ λ°”λ‘œ μ•žμ— μžˆμ„ 경우 더 움직이지 μ•ŠμŠ΅λ‹ˆλ‹€.
@5pecia1
5pecia1 / expandVars.js
Last active August 13, 2021 04:58 — forked from tohagan/expandVars.js
JavaScript - Expand variables in string
// Polyfill to expand variables in a string
// Example: expandEnv("Welcome back ${name}. Glad to see you");
// Example: expandEnv("Welcome back $name. Glad to see you");
// eslint-disable-next-line no-extend-native
function expandEnv(s: string): string {
return s.replace(/\$([\w]+|{([^{}]*)})/g, (str, varName) => {
const vName = varName.startsWith("{") ? varName.substring(1, varName.length - 1) : varName;
var value = process.env[vName];