View init.coffee
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
View fetch.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
const fetch = url => new Promise((resolve, reject) => { | |
https.get(url, res => { | |
res.setEncoding('utf8'); | |
let result = null; | |
res.on('data', data => { | |
result = JSON.parse(data); | |
}); | |
res.on('end', () => { | |
if (res.statusCode != 200) { | |
reject("Error code " + res.statusCode); |
View case-replacement.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
/** dash between num-letter */ const dbnl = [/(\d)([a-zA-Z])|([a-zA-Z])(\d)/g, '$1$3-$2$4']; | |
/** special characters to dash */ const sc2d = [/[^a-zA-Z0-9]+/g, '-']; | |
/** uppercase to dash */ const u2d = [/([A-Z])/g, '-$1']; | |
/** Common preconversion */ | |
const commonPre = fn => cacheStringFunction(str => fn(str.replace(...u2d).replace(...dbnl).replace(...sc2d))); | |
/** dash before a letter */ const dbl = /-([a-zA-Z])/g; | |
export const capitalizeWords = cacheStringFunction(str => str.toLowerCase().replace(/\b(\w)/g, (_, c) => (c ? c.toUpperCase() : ''))); |
View node-check.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
/* eslint-disable @typescript-eslint/no-var-requires */ | |
const { execSync } = require('child_process'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const paths = [ | |
path.resolve(__dirname, 'package.json'), | |
path.resolve(__dirname, 'node_modules', 'last.package.json'), | |
]; |