Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
2024-04-22T22:25:39.9996432Z [USER]
2024-04-22T22:25:39.9997091Z 0:0 1:0 2:0 3:0 4:1 5:0 6:0 7:1 8:0 9:0
2024-04-22T22:25:39.9997788Z 1
2024-04-22T22:25:39.9998545Z 9
2024-04-22T22:25:39.9998789Z
2024-04-22T22:25:39.9999054Z [ASSISTANT]
2024-04-22T22:25:40.0018472Z
2024-04-22T22:25:40.0020039Z ┌──────────────┬─────────────────────────────────────────┐
2024-04-22T22:25:40.0021171Z │ │ Values │
@ctjlewis
ctjlewis / private.txt
Created August 15, 2024 05:01
Bytecode for public properties vs public fields.
This file has been truncated, but you can view the full file.
class WithPrivate {
#field = 0;
increment() { this.#field++; }
get() { return this.#field; }
}
const obj = new WithPrivate();
const iterations = 1000000; // 1 million iterations
for (let i = 0; i < iterations; i++) {
@ctjlewis
ctjlewis / lambda_labs_py39.sh
Created June 26, 2023 03:15
This script is used to set up Python 3.9 + CUDA-enabled PyTorch on a Lambda Labs VM.
#!/bin/bash
# This script is used to set up Python 3.9 + CUDA-enabled PyTorch on a
# Lambda Labs VM.
#
# It performs the following tasks:
#
# 1. Installs Python 3.9 and configures it as the default Python interpreter.
# 2. Installs pip, the Python package installer.
# 3. Configures Jupyter to use Python 3.9 by setting up ipykernel.
@ctjlewis
ctjlewis / twitter-gc-autoscroll.js
Created July 7, 2022 06:49
Scroll up to a given timestamp.
const messageList = document.querySelector("main > div > div > div > div:nth-child(2) > div > div > div > div > div");
/**
* Scroll to the top of the message list.
**/
const scrollToTop = async () => {
messageList.scrollTop = 0;
return await new Promise((resolve) => setTimeout(resolve, 1000));
};
DevTools failed to load source map: Could not load content for chrome-extension://dmkamcknogkgcdfhhbddcghachkejeap/browser-polyfill.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
console.js?eb9e:321 Removing intrinsics.Object.hasOwn
console.js?eb9e:321 Removing intrinsics.Symbol.observable
console.js?eb9e:321 Removing intrinsics.Reflect.decorate
console.js?eb9e:321 Removing intrinsics.Reflect.metadata
console.js?eb9e:321 Removing intrinsics.Reflect.defineMetadata
console.js?eb9e:321 Removing intrinsics.Reflect.hasMetadata
console.js?eb9e:321 Removing intrinsics.Reflect.hasOwnMetadata
console.js?eb9e:321 Removing intrinsics.Reflect.getMetadata
console.js?eb9e:321 Removing intrinsics.Reflect.getOwnMetadata
yarn run v1.22.5
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
Removing intrinsics.Object.getOwnPropertyNames.prototype
failed to delete intrinsics.Object.getOwnPropertyNames.prototype (TypeError#1)
@ctjlewis
ctjlewis / shebang-loader.ts
Created August 10, 2021 19:39
Webpack shebang loader.
/**
* Matches a string which begins with #!, followed by one or more non-return
* characters, followed by any number of return characters.
*
* This will match a Unix-style shebang and all following newlines.
*/
const shebangPattern = /^#![^\n\r]+[\r\n]*/
/**
* A Webpack loader which removes the first-line Unix-style shebang if it
/*
Licensed under the Telework Common License, available at:
https://raw.githubusercontent.com/TeleworkInc/.LICENSE/master/LICENSE
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};
$jscomp.arrayFromIterator=function(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c};$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$js
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
function* range(n) {
let i = 0;
while (i++ < n)
yield i;
}
Array.prototype.sum = function () {
return this.reduce((a, b) => Number(a) + Number(b));
}