Skip to content

Instantly share code, notes, and snippets.

@waiholiu
waiholiu / deleteRG.ps1
Last active January 29, 2022 05:53
Powershell script to delete all resource groups beginning with "todelete"
try
{
"Logging in to Azure..."
Connect-AzAccount -Identity
}
catch {
Write-Error -Message $_.Exception
throw $_.Exception
}
git config --global user.email $(Build.RequestedForEmail)
git config --global user.name $(Build.RequestedFor)
git switch $(Build.SourceBranchName)
git add -A
git commit -m "changes exported from dev"
git push https://$env:SYSTEM_ACCESSTOKEN@dev.azure.com/wai0211/TestProj/_git/Zoo
// part 1 - get this query from advanced find
var xml = `<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_widget">
<attribute name="new_widgetid" />
<attribute name="createdon" />
<attribute name="new_isblue" />
<order attribute="createdon" descending="false" />
</entity>
// part 1 - get this query from advanced find
var xml = `<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_widget">
<attribute name="new_widgetid" />
<attribute name="createdon" />
<attribute name="new_isblue" />
<order attribute="createdon" descending="false" />
</entity>
#Part 1 - Set up credentials
$VMLocalAdminUser = "LocalAdminUser"
$VMLocalAdminSecurePassword = ConvertTo-SecureString "NotARealPassword!@#$%433" -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $VMLocalAdminSecurePassword);
#Part 2 - create RG and VM
New-AzResourceGroup -Name todeleteRG -Location EastUS
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatListModule } from '@angular/material/list';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material/input';
import { MatDividerModule } from '@angular/material/divider';
import {MatBadgeModule} from '@angular/material/badge';
@waiholiu
waiholiu / gist:2651c6b324687e0e8c8b6085272d00ef
Created February 8, 2020 04:23
example of how to access graphql using apollo
import { Component } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import gql from 'graphql-tag';
import { Apollo } from 'apollo-angular';
const gqlTestHelloWorld = gql`
query{
helloworld(newArg: 21)
}
@waiholiu
waiholiu / graphql.module.ts
Created February 8, 2020 03:40
graphql.module.ts (local)
import { LocalStorageService } from 'angular-2-local-storage';
import { NgModule } from '@angular/core';
import { ApolloModule, APOLLO_OPTIONS, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloLink } from 'apollo-link';
import { environment } from 'src/environments/environment';
// const uri = 'https://o5x5jzoo7z.sse.codesandbox.io/graphql'; //our test Graphql Server which returns rates
const uri = environment.serverUrl + '/graphql';
@waiholiu
waiholiu / GraphQLController.cs
Created January 3, 2020 01:31
GraphQLController.cs
using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Types;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@waiholiu
waiholiu / graphql.module.ts
Created August 8, 2019 13:13
How to insert custom headers (eg. auth token) into an apollo request in Angular module
import { LocalStorageService } from 'angular-2-local-storage';
import { NgModule } from '@angular/core';
import { ApolloModule, APOLLO_OPTIONS, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloLink } from 'apollo-link';
// const uri = 'https://o5x5jzoo7z.sse.codesandbox.io/graphql'; //our test Graphql Server which returns rates
const uri = 'https://localhost:5001/graphql';