コメント除去 + 関数リストアップ const fs = require('fs'); const path = require('path'); function removeComments(code) { const lines = code.split(/(?マルチラインコメントモード if (char === '*' && line[i + 1] === '/') { // 終端検出 inMultili…

コメント除去 function removeComments(code) { const lines = code.split(/(?マルチラインコメントモード if (char === '*' && line[i + 1] === '/') { // 終端検出 inMultilineComment = false; i++; // /ぶんをスキップ } else if (char === '\n') { // …

import re def split_data(input_str): pattern = r"(\d+?)\s*:(.*?)[,\s]" results = [] for match in re.finditer(pattern, input_str): num = match.group(1) data = match.group(2) results.append((num, data)) return results # 使用例 input_str = "0…

python学習

import lxml.etree as etree # 追加・更新関数 class PathManipulator: @staticmethod def custom_split(xpath, sep='/'): result = [] in_quotes = False start = 0 for i, char in enumerate(xpath): if char in ('"', "'"): in_quotes = not in_quotes el…

javascript で関数の行を取得する const fs = require('fs'); // ファイルパスをコマンドライン引数から取得 //const filePath = process.argv[2]; const filePath = 'input.js'; if (!filePath) { console.error('ファイルパスが指定されていません。'); pr…

CSVファイルパースと検索条件 const fs = require('fs'); const parse = require('csv-parser/lib/sync'); class CsvReader { constructor(filePath, hasHeader = true) { this.filePath = filePath; this.hasHeader = hasHeader; } readCsv() { try { const…

htmlに動的にscriptを挿入するためのサンプル

htmlに動的にscriptを挿入するためのサンプル first.js function loading(scriptSrc) { var script = document.createElement('script'); script.src = scriptSrc; document.head.appendChild(script); } loading('second.js'); <html lang="en"> <head> <meta charset="UTF-8"> </meta></head></html>

webpack学習中

複数のエントリーポイントファイルを持ち、それぞれ別の出力ファイルにバンドルするwebpack.config.jsの例 const path = require('path'); module.exports = { entry: { test1: './src/test1.js', // test1.js をエントリーポイントとして指定 test2: './src…

はじめに

恥の多い人生を送ってきました