Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Eonasdan's full-sized avatar

Eonasdan Eonasdan

View GitHub Profile
@Eonasdan
Eonasdan / renew_ssl_cert.yaml
Last active March 1, 2024 00:38 — forked from TJ-developer/renew_ssl_cert.yaml
Homeassistant Blueprint for SSL-Certificate renewal
blueprint:
name: Renew Let's Encrypt Certificate
description: Renew Certificate when due date is below given value
domain: automation
input:
cert_expiry_sensor:
name: Certificate Expiry Sensor
description: Sensor from the Certificate Expiry Integration (https://www.home-assistant.io/integrations/cert_expiry)
selector:
entity:
@Eonasdan
Eonasdan / azure-cognitive-search-index-schema.json
Created November 8, 2022 15:28
Azure Cognitive Search Index schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Required. The name of the index. An index name must only contain lowercase letters, digits or dashes, cannot start or end with dashes and is limited to 128 characters."
},
"description": {
"type": "string",
@Eonasdan
Eonasdan / date-picker.component.html
Created August 22, 2022 13:51
Tempus Dominus Angular directives
<!--suppress XmlDuplicatedId, HtmlFormInputWithoutLabel -->
<app-field-wrapper
[label]="label"
[control]="control"
[controlName]="controlName"
>
<ng-container *ngIf="!readOnly">
<div
class="input-group date"
data-td-target-input="nearest"
@Eonasdan
Eonasdan / JsRuntimeExtensions.cs
Last active July 14, 2022 01:00
Console log extensions for Blazor
public static class JsRuntimeExtensions
{
/// <summary>
/// Calls "console.log" on the client passing the args along with it.
/// </summary>
/// <example>
/// LogAsync("data") //same as console.log('data')
/// </example>
/// <example>
/// LogAsync("data", myData) //same as console.log('data', myData)
@Eonasdan
Eonasdan / default_browser.vbs
Created March 7, 2022 14:43
W10 change default browser to Chrome
Set WshShell = WScript.CreateObject("WScript.Shell")
' Open the default settings window
WshShell.Run "ms-settings:defaultapps"
WScript.Sleep 5000 ' Wait until open (adjust if necessary)
' Adjust number of tabs until you reach the browser choice setting
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
@Eonasdan
Eonasdan / readme.md
Last active March 3, 2022 20:55
Annoying clone/scrapper sites

What's this?

When doing a Google search, specially for code, I find a bunch of sites that just regurgitate StackOverflow or Github.

Add the following to your search to ignore these sites. I'll try to keep updating this when I find them.

-githubmemory.com -githubmate.com -githubhot.com

@Eonasdan
Eonasdan / mime-types.json
Last active February 14, 2022 00:20 — forked from JoeyBurzynski/mime-types.php
Array of file extensions, mime types and friendly application or name
[
{
"type": "application/vnd.hzn-3d-crossword",
"name": "3D Crossword Plugin",
"extensions": [
"x3d"
]
},
{
"type": "video/3gpp",
@Eonasdan
Eonasdan / DevMachineSetup.ps1
Last active January 26, 2022 17:56 — forked from codebytes/DevMachineSetup.ps1
DevMachineSetup
#Install WinGet
#Based on this gist: https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
"Installing winget Dependencies"
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

It is possible to get an Angular component through the Chrome console. This allows you to inspect form controls, errors, etc.

  1. Select the Angular component in the DevTools DOM
  2. In the console you can use ng.getComponent($0).formGroup.valid where formGroup is the name of a public property that's an Angular FormGroup

You can use this function to get a list of all the errors in a form group.

var getFormErrors = (form) => {
    if (!form.controls) {
@Eonasdan
Eonasdan / DevOps-Update-Version-With-Build-Number.ps1
Created December 21, 2021 14:43
This powershell script can be used as an Azure DevOps task to take the build number and update appsettings or other json file as a version
$config = Get-Content "[path_to]\appsettings.json" -Raw|ConvertFrom-Json
Write-Host Current Server Version: $mainServerConfig.Version
$config.version = $Env:BUILD_BUILDNUMBER;
$config|ConvertTo-Json |Set-Content "[path_to]\appsettings.json"
Write-Host Updated Version: $Env:BUILD_BUILDNUMBER