node --inspect index.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
// generated by ChatGPT | |
import * as fs from 'fs'; | |
import { parseStringPromise } from 'xml2js'; | |
// OPMLファイルをパースして出力する関数 | |
async function parseOpml(filePath: string): Promise<void> { | |
try { | |
// OPMLファイルを読み込む | |
const opmlData = fs.readFileSync(filePath, 'utf-8'); |
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
(async () => { | |
const test = await new Promise((resolve) => { | |
console.log('test1'); | |
process.on('message', (message) => { | |
resolve(message.payload); | |
}); | |
console.log('test2'); | |
if (process.send !== undefined) { | |
process.send(''); |
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
// will be used for type definition of select method for RDB | |
type ObjectKeys<T extends { [key: string]: any }> = keyof T; | |
function test<TRecord>( | |
columns: ObjectKeys<TRecord>[], | |
) { | |
console.log(columns); | |
} | |
test<{ |
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
// Usage: | |
// node index.js ${input} ${output} | |
// Require: | |
// Node.js | |
// ffmpeg | |
const fs = require('fs'); | |
const path = require('path'); | |
const exec = require('child_process').execSync; | |
const originDir = process.argv[2]; |
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
class Result { | |
constructor(answers) { | |
this.answers = answers; | |
} | |
score() { | |
let result = 0; | |
this.answers.forEach((answer) => { | |
question = answer.question; |
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
/** async functionの話 */ | |
// いつものPromise | |
const a = () => { | |
return new Promise((resolve, reject) => { | |
resolve(1); | |
}); | |
}; | |
// async function | |
const b = async () => { |
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
javascript:(()=>{let getLfURLCode=()=>"\n";let hostname="https://scrapbox.io";let apiURI="/api/pages/:projectName/:pageTitle";let pathname=location.pathname;let[projectName,pageTitle]=pathname.substring(1).split("/");let targetURI=apiURI.replace(":projectName",projectName).replace(":pageTitle",pageTitle);let requestURL=targetURI;let request=new Request(requestURL);let myInit={method:"GET",credentials:"same-origin"};let checkContainsKeyword=body=>{return/#テンプレート|\[テンプレート\]/.test(body)};let openNewPage=(title,body)=>{const encodedBody=encodeURIComponent(body);window.open(`${hostname}/${projectName}/${title}?body=${encodedBody}`)};fetch(request,myInit).then(res=>{if(!res.ok){throw res}return res.json()}).then(data=>{let body="";data.lines.shift();data.lines.forEach(({text:text})=>{body+=text+getLfURLCode()});console.log(body);if(!checkContainsKeyword(body)){alert("テンプレートタグがページに存在しません");throw new Error("Target tag not found")}const newPageTitle=prompt("作成したいページ名を入力してください");openNewPage(newPageTitle,body)}).catch(e |
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
// Please pass `names` and `foods` from Zapier | |
// If you want to filter by food name, plz pass `specificFood` from Zapier | |
const names = inputData.names; | |
const foods = inputData.foods; | |
const specificFood = inputData.specificFood; | |
const delimitor = ','; // If you want to change delimiter, fix this line | |
const nameList = names.split(delimitor); | |
const foodList = names.split(delimitor); |
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
blackfire/prepare: | |
wget -O - https://packagecloud.io/gpg.key | sudo apt-key add - | |
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list | |
sudo apt-get update | |
blackfire/agent: | |
sudo apt-get install blackfire-agent | |
sudo blackfire-agent -register | |
blackfire/start: |
NewerOlder