Skip to content

Instantly share code, notes, and snippets.

@russelldavis
russelldavis / git-rev-run.sh
Created November 18, 2015 01:13
Run a given command over a range of git revisions
#!/bin/bash
#
# This script runs a given command over a range of Git revisions. Note that it
# will check past revisions out! Exercise caution if there are important
# untracked files in your working tree.
#
# This is adapted from Gary Bernhardt's dotfiles:
# https://github.com/garybernhardt/dotfiles
#
# Example usage:
@russelldavis
russelldavis / debug-in-byebug-with-redirects.rb
Last active June 3, 2019 16:42
How to debug in byebug with stdin/stdout/stderr redirected
# Before calling `byebug`, run the following:
require 'io/console'
require 'byebug'
Readline.input = IO.console
Readline.output = IO.console
Byebug::Context.interface.instance_variable_set('@input', IO.console)
Byebug::Context.interface.instance_variable_set('@output', IO.console)
Byebug::Context.interface.instance_variable_set('@error', IO.console)
# This used to be built in to byebug (https://github.com/deivid-rodriguez/byebug/pull/211)
@russelldavis
russelldavis / decorator.py
Last active May 2, 2020 22:07
Simplifies creation of decorators
from functools import wraps
def decorator(wrapper):
"""Simplifies creation of decorators.
Removes a layer of nesting (flat is better than nested).
Note that args and kwargs are passed in as simple positional args,
rather than unpacked *args and **kwargs. This avoids potential naming
conflicts between kwargs defined in the wrapped function and the first
arg of the wrapper (usually named "wrapped"). As a side effect, it
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CreationDate</key>
<real>591603148.251261</real>
<key>Macros</key>
@russelldavis
russelldavis / outDir.md
Created January 10, 2024 21:08
tsconfig outDir notes
  • outDir can't be in a shared config dir due to microsoft/TypeScript#29172
  • It's needed even with noEmit, because tsconfig.tsbuildinfo will go there
diff --git a/templates/pages-template-plugin.ts b/templates/pages-template-plugin.ts
index 3b99ea2a82d18d3cbbe713af437dc53c33bd1273..971714e99d2d162fe525d7cab7c6ddf42b1bba1d 100644
--- a/templates/pages-template-plugin.ts
+++ b/templates/pages-template-plugin.ts
@@ -146,7 +146,7 @@ export default function (pluginArgs: unknown) {
if (result.done === false) {
const { handler, params, path } = result.value;
const context = {
- request: new Request(request.clone()),
+ request: request,