Skip to content

Instantly share code, notes, and snippets.

View dwelch2344's full-sized avatar

David Welch dwelch2344

View GitHub Profile
@dwelch2344
dwelch2344 / should this run on mac.txt
Last active October 1, 2023 20:11
Is NX 16 broken or is it just me?
View should this run on mac.txt
→ mkdir -p /tmp/nx_darwin
cd /tmp/nx_darwin
npm i @nx/nx-darwin-arm64@16.8.0
chmod a+x node_modules/@nx/nx-darwin-arm64/nx.darwin-arm64.node
node_modules/@nx/nx-darwin-arm64/nx.darwin-arm64.node
added 1 package in 1s
zsh: exec format error: node_modules/@nx/nx-darwin-arm64/nx.darwin-arm64.node
View ghetto_chrome_xml.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const semver = require("semver");
const config_1 = require("../config");
const http_utils_1 = require("../http_utils");
const config_source_1 = require("./config_source");
class ChromeXml extends config_source_1.XmlConfigSource {
constructor() {
super('chrome', config_1.Config.cdnUrls()['chrome']);
this.maxVersion = config_1.Config.binaryVersions().maxChrome;
View gitcheck.sh
#!/bin/bash
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
for d in *hexly*/ ; do
if [[ ! -d "$d/.git" ]]; then
: # noop
else
cd $d
if [[ -n $(git status -s) ]]; then
echo -e "${YELLOW}$d${NC}"
@dwelch2344
dwelch2344 / scrub-apollo-fields-for-active-and-report.js
Created January 12, 2022 17:25
Search Apollo GraphQL Fields report for active fields in last 24 hours
View scrub-apollo-fields-for-active-and-report.js
// inject jquery
(function (){ function l(u, i) { var d = document; if (!d.getElementById(i)) { var s = d.createElement('script'); s.src = u; s.id = i; d.body.appendChild(s); } } l('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', 'jquery') })();
const runReport = () => {
$ = jQuery
// get all the rows with 0 calls and remove htem
targets = $('span.flex.items-center ').toArray().map($)
targets.filter(e => parseInt(e.html()) === 0).forEach(e => e.closest('tr').remove())
@dwelch2344
dwelch2344 / class-wc-shipstation-api-export.php
Last active March 17, 2021 11:33
Add hooks to WC_Shipstation_API_Export
View class-wc-shipstation-api-export.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* WC_Shipstation_API_Export Class
*/
class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
View wait-for-event-emitter-promises.ts
test('events', async() => {
const { EventEmitter } = require('events')
const ee = new EventEmitter()
const handler = (breadcrumb: string, delay: number) =>
(promises: Promise<unknown>[]) => {
promises.push(new Promise(resolve => {
View mc-crash.log
[02:19:22] [Async Chat Thread - #6/INFO]: [duece]<8bagels> oh cool
[02:19:34] [Async Chat Thread - #6/INFO]: [duece]<dwelch2344> the browser maps a little janky. you have to click the world (duece) and then refresh, but then you'll get UUID markers for anyone running around
[02:19:46] [Async Chat Thread - #6/INFO]: [duece]<dwelch2344> that's all got to move off server soon (we do crash sometimes - lots ot tighten up now)
[02:19:59] [Async Chat Thread - #6/INFO]: [duece]<dwelch2344> but it's helpful, especially if you're coop or lost :P
[02:20:05] [Async Chat Thread - #6/INFO]: [duece]<dwelch2344> ok, bbl
[02:20:08] [Server thread/INFO]: dwelch2344 lost connection: Disconnected
[02:20:08] [Server thread/INFO]: dwelch2344 left the game
[02:23:52] [Server thread/INFO]: 8bagels has made the advancement [Monster Hunter]
[02:24:46] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 17444ms or 348 ticks behind
[02:25:32] [Server thread/INFO]: 8bagels lost connection: Timed out
View serverless.yml
service: example
# Note: I write these examples using the latest version of Serverless. I pin the example
# to that version so that I know it will work for you even if you find it a year later.
# Likely, you can remove this line and use the example with any recent version of
# Serverless. Give it a shot if you're using a different version.
# frameworkVersion: '=1.34.1'
custom:
defaultRegion: us-west-2
View fix-dandb.js
function validateBusinessSummaryPage() {
addValidators();
try {
var isValidForm = jQuery("#business_summary_update_company").validate({
rules: {
"business_summary_update_company:duns_number_input": {
number: true,
},
"business_summary_update_company:company_name_input": {
required: true,
View sentry.middy.js
//...
const middleware = {
before: (handler, next) => {
Sentry.configureScope(scope => {
const route = pathOr('<unknown>', ['event', 'path'], handler)
handler.context.sentry = scope
// doesn't work
// scope.addBreadcrumb({ message: 'scope.breadcrumb route=' + route }, 100)
Sentry.addBreadcrumb(
{ message: 'Sentry.breadcrumb route=' + route },