Skip to content

Instantly share code, notes, and snippets.

@tbremer
tbremer / README.md
Last active April 5, 2023 19:36
Factorio Train Loader and Unloader (circuit based)

Factorio Circuit Based Loader and Unloader


Loader

  • Takes two arguments in constant combinator
    • Cargo Wagon: Number of items on a train
    • Locomotive: Number of trains that this station can fit
  • Calls up to Locomotive number of trains
@tbremer
tbremer / index.js
Created February 12, 2023 16:54
Github Markdown Print
(() => {
document.body.appendChild(document.querySelector(".markdown-body"));
document.querySelector("div.page-responsive")?.remove();
(Array.from(document.querySelectorAll('div')) ?? []).forEach(e => { if (e.textContent === '') e.style = 'page-break-after: always;' })
window.print();
})();
@tbremer
tbremer / README.md
Created January 7, 2022 15:44
Ben and Jerry's Sweet Cream Base #1

Sweet Cream Base

  • 2 large eggs
  • 2 cups heavy or whipping cream
  • ¾ cup sugar
  • 1 cup milk
  1. Whisk the eggs in a mixing bowl until light and fluffy, 1 to 2 minutes.
  2. Whisk in the sugar, a little at a time, then continue whisking until completely blended, about 1 minute more.
  3. Pour in the cream and milk and whisk to blend.
@tbremer
tbremer / foo.json
Created November 3, 2020 19:47
Serve Custom Headers
{
"date": 1604432085011
}
@tbremer
tbremer / demo.Dockerfile
Created October 21, 2020 04:23
Deno Dockerfile
FROM ubuntu
WORKDIR /deno
ENV DENO_VERSION 1.3.1
RUN apt-get update && \
apt-get install curl unzip -y && \
curl -fsSL https://github.com/denoland/deno/releases/download/v$DENO_VERSION/deno-x86_64-unknown-linux-gnu.zip \
--output deno.zip && \
unzip deno.zip && rm deno.zip && \
@tbremer
tbremer / README.md
Last active October 15, 2019 21:17
React `useMatchMedia` hook
@tbremer
tbremer / README.md
Last active August 23, 2019 04:45
Build Static HTML site with React.

Static HTML from React

Simple static HTML builder for using React as the compiler.

Running

npx babel-node index.js or npm start

Project structure

@tbremer
tbremer / README.md
Last active February 18, 2019 21:36
scheduler

scheduler

const schedule = new scheduler(() => console.log("Hello, world!"), 1500);

schedule.setInterval(); // start the logger
schedule.pause(3e3); // pause the logger for 3 seconds
@tbremer
tbremer / tap-es5.js
Created November 1, 2018 17:15
Jest Tap Plugin - es6 - flow.
"use strict";
var _createClass = (function() {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
@tbremer
tbremer / index.js
Last active February 21, 2018 00:25
XML Parsing
// create Document tree from XML tree
const XML = `<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>`;
const MAP = {