This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
What happens? | |
- `new Type().what` is looked up with a call to `get` on the proxy | |
- a function is returned that will look up `METHOD_NAME` when called | |
- `METHOD_NAME` is called because of the `()` behind `new Type().what` | |
- if `METHOD_NAME` exists on you object, your own function is called | |
- if not, because of prototypal inheritance, `get` is called again | |
- `name` is now `METHOD_NAME` and we can throw as we know `METHOD_NAME` is not implemented on the type | |
credits http://soft.vub.ac.be/~tvcutsem/proxies/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1.install gource using HomeBrew | |
$ brew install gource | |
# 2.install avconv | |
git clone git://git.libav.org/libav.git | |
cd libav | |
# it will take 3-5 minutes to complie, be patient. | |
./configure --disable-yasm | |
make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run on https://www.linkedin.com/mynetwork/invite-connect/connections/ | |
while(true) { | |
document.querySelector('.mn-connection-card__dropdown-trigger').click() | |
await new Promise(resolve => setTimeout(resolve, 500)) | |
document.querySelector(".artdeco-dropdown__content-inner button").click() | |
await new Promise(resolve => setTimeout(resolve, 500)) | |
document.querySelector("[data-test-dialog-primary-btn]").click() | |
await new Promise(resolve => setTimeout(resolve, 500)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { z } from "zod"; | |
import { zodToTs, printNode } from "zod-to-ts"; | |
// Replace with your `openai` thing | |
import { openai } from "../openai.server"; | |
import endent from "endent"; | |
function createJSONCompletion<T extends z.ZodType>({ | |
prompt, | |
schema_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# STEP 1: Load | |
# Load documents using LangChain's DocumentLoaders | |
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html | |
from langchain.document_loaders.csv_loader import CSVLoader | |
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv') | |
data = loader.load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"environment": "staging" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Makes your remote containers low level API accessible via: | |
import accessFederatedContainer from "access-federated-containers"; | |
accessFederatedContainer("app2") | |
*/ | |
/** @typedef {import("webpack").Compiler} Compiler */ | |
/** @typedef {import("webpack").Compilation} Compilation */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = class EmitAllPlugin { | |
constructor(opts = {}) { | |
this.ignorePattern = opts.ignorePattern || /node_modules/; | |
} | |
shouldIgnore(path) { | |
return this.ignorePattern.test(path); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @param {string} remote - the remote global name | |
* @param {object | string} shareScope - the shareScope Object OR scope key | |
* @param {string} remoteFallbackUrl - fallback url for remote module | |
* @returns {Promise<object>} - Federated Module Container | |
*/ | |
const getOrLoadRemote = (remote, shareScope, remoteFallbackUrl = undefined) => | |
new Promise((resolve, reject) => { | |
// check if remote exists on window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var devices = [ | |
{ name: 'Desktop - Huge', width: 2880, height: 1800, ratio: 2, type: 'desktop' }, | |
{ name: 'Desktop - Extra Large', width: 1920, height: 1080, ratio: 1, type: 'desktop' }, | |
{ name: 'Desktop - Large', width: 1440, height: 900, ratio: 1, type: 'desktop' }, | |
{ name: 'Desktop - HiDPI', width: 1366, height: 768, ratio: 1, type: 'desktop' }, | |
{ name: 'Desktop - MDPI', width: 1280, height: 800, ratio: 1, type: 'desktop' }, | |
{ name: 'Laptop with HiDPI screen', width: 1440, height: 900, ratio: 2, type: 'desktop' }, | |
{ name: 'Laptop with MDPI screen', width: 1280, height: 800, ratio: 1, type: 'desktop' }, | |
{ name: 'Laptop with touch', width: 1280, height: 950, ratio: 1, type: 'desktop' }, | |
{ name: 'Tablet - Portrait', width: 768, height: 1024, ratio: 1, type: 'tablet' }, |
NewerOlder