Skip to content

Instantly share code, notes, and snippets.

View apaleslimghost's full-sized avatar
💚
a pale slim ghost

Kara Brightwell apaleslimghost

💚
a pale slim ghost
View GitHub Profile
#!/usr/bin/env node
const fs = require("fs");
const words = fs.readFileSync("/usr/share/dict/words", "utf-8").split("\n");
const mediumWords = words.filter((word) => word.length > 5 && word.length < 10);
const randomWord = (words) => words[Math.floor(words.length * Math.random())];
undefined;
const titleCase = (s) => s[0].toUpperCase() + s.slice(1).toLowerCase();
undefined;
@apaleslimghost
apaleslimghost / circle.js
Created October 3, 2022 13:51
script to test circleci config filters
const yaml = require('yaml')
const fs = require('fs')
const argv = require('minimist')(process.argv.slice(2))
const config = fs.readFileSync('./.circleci/config.yml', 'utf-8')
const { workflows } = yaml.parse(config)
const [key, sha] = argv.branch ? ['branches', argv.branch] : ['tags', argv.tag]
@apaleslimghost
apaleslimghost / bower.mjs
Last active February 8, 2022 15:50
origami bower to npm peerdependency migrator
#!/usr/bin/env volta run --node 16 npx -y zx
const bowerPath = path.resolve(process.cwd(), './bower.json')
if(!await fs.exists(bowerPath)) {
console.log(`no bower.json in ${path.basename(process.cwd())}, skipping`)
} else {
const { dependencies } = require(bowerPath)
const depSpecifiers = Object.keys(dependencies).map(dep => `@financial-times/${dep}`)

how to connect to This Land from Bedrock

if you're on a console

  1. set your DNS server to 104.238.130.180 (or one of the others if that doesn't work)
  2. connect to any server list

link your Bedrock account with your Java account

  1. connect to link.geysermc.org on both Bedrock and a Java client (port 19132 on Bedrock, 25565 on Java)
//////////// x-teaser ////////////
const Teaser = ({ teaser, enableStandfirst }) => <div class="o-teaser">
<h1>{teaser.title}</h1>
{enableStandfirst && <h2>{teaser.standfirst}</h2>}
</div>
//////// next-front-page /////////
app.get('/', (req, res) => {
const { usb } = require('webusb')
async function initPrinter() {
const printer = await usb.requestDevice({
filters: [
{
vendorId: 0x0416,
productId: 0x5011
}
]
#!/usr/bin/env node
const fs = require('fs').promises
const minimist = require('minimist')
async function getTasks() {
const packages = await fs.readdir('node_modules/@apaleslimghost')
return packages.filter(pkg => pkg.startsWith('n-gage-') && pkg !== 'n-gage-cli').map(pkg => pkg.replace(/^n-gage-/, ''))
}
.preview-page {
margin-top: 0 !important;
}
.container {
max-width: 980px;
width: auto !important;
padding: 1em;
}
application 'config.generators.helper = false'
application 'config.generators.assets = false'
application 'config.generators.view_specs = false'
application 'config.generators.template_engine = false'
gem 'react-rails'
generate 'react:install'
run 'rm -rf lib'
run 'rm -rf app/assets'
module.exports = function setNbtValue(nbt, [key, ...rest], value) {
if(!nbt || nbt.value) return
if(rest.length === 0) {
nbt.value[key].value = value
} else {
setNbtValue(nbt.value[key], rest, value)
}
}