Skip to content

Instantly share code, notes, and snippets.

View Jordan-Hall's full-sized avatar
💭
Faced with tyranny by the big corporation, open source becomes the resistance.

Jordan Hall Jordan-Hall

💭
Faced with tyranny by the big corporation, open source becomes the resistance.
  • Mansfield woodhouse
View GitHub Profile
@Jordan-Hall
Jordan-Hall / compiler.ts
Created October 26, 2024 19:41
Make the functions return state correctly for ivy
import * as ts from "typescript";
// Input function
const sourceCode = `
function example() {
let test = 1;
let helloWorld;
const add = (by) => {
test += by;
};
@Jordan-Hall
Jordan-Hall / nx+19.8.2.patch
Created September 27, 2024 13:19
Community remote cache support
diff --git a/node_modules/nx/src/tasks-runner/cache.js b/node_modules/nx/src/tasks-runner/cache.js
index 36a7089..a1b7809 100644
--- a/node_modules/nx/src/tasks-runner/cache.js
+++ b/node_modules/nx/src/tasks-runner/cache.js
@@ -110,7 +110,8 @@ class DbCache {
}
}
else {
- return ((await this.getPowerpackS3Cache()) ??
+ return ((await this.getPowerpackCache(nxJson.communityCache)) ??
@Jordan-Hall
Jordan-Hall / app.treaty
Last active September 14, 2024 04:19
functional ivy
<style>
button { cursor: pointer }
label { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.cm-editor { height: 100%; }
#loading { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; justify-content: center; align-items: center; }
#container { display: flex; height: 100vh; }
#left { display: flex; flex: 1; flex-direction: column; border-right: 1px solid #444 }
#editor { flex: 1; overflow-y: auto; }
#panel { height: 20%; overflow-y: auto; padding: 1em; color: #d1d5da; border-top: 1px solid #444!important; }
#right { flex: 1; display:flex; flex-direction: column; min-width: 0; }
import { CreateDependenciesContext, joinPathFragments } from '@nx/devkit';
import { execSync } from 'child_process';
import { hashArray } from 'nx/src/hasher/file-hasher';
import {getYarnLockfileDependencies, getYarnLockfileNodes} from 'nx/src/plugins/js/lock-file/yarn-parser'
const lockFilePath = process.cwd() + '/bun.lockb';
let lockFileContents = execSync(`bun ${lockFilePath}`, {maxBuffer: 1024 * 1024 * 10 }).toString();
const hashed = hashArray(['19.1.0-beta.5', lockFileContents]);
console.log('hashed',hashed);
@Jordan-Hall
Jordan-Hall / nx+16.8.1.patch
Last active January 15, 2024 12:23
Bun as a NX package manager
diff --git a/node_modules/nx/schemas/nx-schema.json b/node_modules/nx/schemas/nx-schema.json
index 091b7d0..227e128 100644
--- a/node_modules/nx/schemas/nx-schema.json
+++ b/node_modules/nx/schemas/nx-schema.json
@@ -201,7 +201,7 @@
"packageManager": {
"type": "string",
"description": "The default package manager to use.",
- "enum": ["yarn", "pnpm", "npm"]
+ "enum": ["yarn", "pnpm", "npm", "bun"]
@Jordan-Hall
Jordan-Hall / ast-merge-vite-config.ts
Last active January 14, 2023 01:12
Merge vite config via ast
import * as ts from 'typescript';
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
import { dirname } from 'path';
function mergeDeeply(first: ts.ObjectLiteralExpression, second: ts.ObjectLiteralExpression) {
const mergedProperties: ts.ObjectLiteralElementLike[] = [];
// Add properties from first object
for (const prop of first.properties) {
mergedProperties.push(prop);
@Jordan-Hall
Jordan-Hall / style.css
Created March 29, 2022 14:45
Accessibility css
* {
cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJBJREFUeNrs2dEKgDAIhWEN3/+VLYtBF12MppHwDxY0uvg4DJpORcSl0bB4uPcwq+oFHu8/956pbtJsAAYMGDBgwIABA044t3pMEgb8VU2XsWdn1o/aUUn4bchPBWNFYWvVidxbCFGmr7YULBs1YDPfsYcXEi9ryvDjAAwYMGDAgAED7nK8bHG7qNLs6nYXYAAheh5j8Qw5fwAAAABJRU5ErkJggg==) 22 22, auto !important;
}
@Jordan-Hall
Jordan-Hall / vite.config.js
Created February 20, 2022 11:55
vite test angular?
import { defineConfig } from 'vite';
import { AngularPlugin } from '@nxext/angular/plugins/angular-vite-compiler';
export default defineConfig({
plugins: [
AngularPlugin(),
],
resolve: {
preserveSymlinks: true,
},
@Jordan-Hall
Jordan-Hall / jwt.ts
Created December 20, 2020 01:16
Alosaur Session JWT
import { AuthClaims, AuthenticationScheme, Identity } from "https://deno.land/x/[email protected]/src/security/authentication/core/mod.ts";
import { Content } from "https://deno.land/x/[email protected]/mod.ts";
import { SecurityContext } from "https://deno.land/x/[email protected]/src/security/context/security-context.ts";
import { verify as verifySignature } from "https://deno.land/x/[email protected]/_signature.ts";
import { create, decode, getNumericDate } from "https://deno.land/x/[email protected]/mod.ts";
import { Algorithm } from "https://deno.land/x/[email protected]/_algorithm.ts";
import { DAYS_30 } from "../../../auth/environmental.ts";
export const IdentityKey = "__identity_jwt";
const AuthorizationHeader = "Authorization";
import { connect, Redis } from "https://deno.land/x/redis/mod.ts";
import { SessionStore } from "https://deno.land/x/[email protected]/src/security/session/src/store/store.interface.ts";
type StringKeyObject = { [key: string]: unknown };
export class RedisSession<T = StringKeyObject> implements SessionStore {
private redis?: Redis;
private allSid: string[] = [];