// Motivation: https://github.com/angular/angular/issues/18877
import { Directive, ElementRef, AfterViewInit } from '@angular/core';
@Directive({
standalone: true,
selector: '[remove-host]'
})
export class RemoveHostDirective implements AfterViewInit {
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
Manually download Windows Subsystem for Linux distro packages: | |
# @link: https://docs.microsoft.com/en-us/windows/wsl/install-manual#installing-your-distro | |
Windows Subsystem for Linux Installation Guide for Windows 10: | |
# @link: https://docs.microsoft.com/en-us/windows/wsl/install-win10#set-your-distribution-version-to-wsl-1-or-wsl-2 | |
Updating Wsl : | |
Download Msi Wsl update package from below link then install it : | |
@link : https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi |
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
class PathMe { | |
moves: string[] = []; | |
constructor() { | |
this.moves = []; | |
return this; | |
} | |
moveTo(x: number, y: number) { |
AutoGPT is an extension of ChatGPT to automatically run an agent to complete a solution without human intervention.
Normally, an OpenAI API key is used.
For Azure OpenAI, you must use either an API token or an Azure Active Directory account.
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
//Snippet from Program.cs which adds the provider and sets up a Settings class to map the settings | |
using ErikNoren.Configuration; | |
using TestMvcWebApplication; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Configuration.AddSqlDatabase(config => | |
{ | |
//We can get the connection string from previously added ConfigurationProviders to use in setting this up | |
config.ConnectionString = builder.Configuration.GetConnectionString("DemoDatabase"); |
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 { Browser, chromium, firefox, webkit } from "playwright"; | |
import { afterAll, beforeAll, describe, it } from "vitest"; | |
const browserTypes = process.env.ALL_BROWSERS | |
? [chromium, firefox, webkit] | |
: [chromium]; | |
for (const browserType of browserTypes) { | |
describe(`browser:${browserType.name()}`, () => { | |
let browser: Browser; |
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
type None = { | |
flatMap<U>(f: (value: null) => Option<U>): None | |
getOrElse<U>(def: U): U | |
isEmpty(): true | |
map<U>(f: (value: null) => U): None | |
nonEmpty(): false | |
orElse<U>(alternative: Option<U>): Option<U> | |
} | |
type Some<T> = { |
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
// @see http://www.scala-lang.org/api/2.7.4/scala/Option.html | |
class Opt<A> { | |
value: A | null | |
// TODO: use constructor fn instead | |
static from<A>(value: A | null): Opt<A> { | |
return value == null ? None : Some(value) | |
} |
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
// orignal author @dylanvdmerwe - https://dev.to/dylanvdmerwe/reduce-angular-style-size-using-purgecss-to-remove-unused-styles-3b2k | |
const exec = require("child_process").exec; | |
const fs = require("fs"); | |
const path = require("path"); | |
const chalk = require("chalk"); | |
function removeUnusedCSS() { | |
var pathPrefix = process.argv.slice(2)[0]; | |
// find the styles css file | |
const files = getAllFiles(`./${pathPrefix}/`, ".css"); |
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
// https://dev.to/ryansolid/building-a-reactive-library-from-scratch-1i0p | |
// https://www.youtube.com/watch?v=vHy7GRpTpm8&list=LL&index=3&t=514s | |
// https://codesandbox.io/s/0xyqf?file=/reactive.js:0-1088 | |
// A Dependency has many different Subscribers depending on it | |
// A particular Subscriber has many Dependencies | |
type Dependency = Set<Subscriber>; | |
type Subscriber = { | |
execute(): void; |
NewerOlder