Skip to content

Instantly share code, notes, and snippets.

View chenxizhang's full-sized avatar
🎯
Focusing

Ares Chen chenxizhang

🎯
Focusing
View GitHub Profile
function GetEncoder() {
$format = [Drawing.Imaging.ImageFormat]::Jpeg
$codecs = [System.Drawing.Imaging.ImageCodecInfo]::GetImageDecoders()
foreach ($codec in $codecs) {
if ($codec.FormatID -eq $format.Guid) {
return $codec;
}
}
return $null;
@chenxizhang
chenxizhang / teamsautomation.cs
Created November 22, 2019 06:26
invite guest user to Team
using System;
using Microsoft.Graph;
using Microsoft.Graph.Auth;
using Microsoft.Identity.Client;
namespace teamsautomation
{
class Program
{
static void Main(string[] args)
import React from 'react';
import './App.css';
import { PrimaryButton, Checkbox } from 'office-ui-fabric-react';
import { stat } from 'fs';
interface IQuestion {
title: string,
options: string[],
answer: string[]
}
// 第一个文件
import React from 'react'
interface MyContext {
language: string
}
export const languageContext = React.createContext<MyContext>({
language: "en-US"
});
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
import { Action, createStore } from 'redux';
import { Provider, ReactReduxContext } from 'react-redux';
const reducer = (state = 0, action: Action) => {
switch (action.type) {
@chenxizhang
chenxizhang / react-typescript-101-2.tsx
Created June 16, 2019 09:32
github user profiler
/*
这是一个完整的React例子,用来根据用户输入查找Github用户数据,并且添加到一个集合中进行展示
*/
import React, { useState, FormEvent } from 'react';
//用户配置文件的接口定义
interface UserProfile {
key: number,
photo: string,
import React, { useState } from 'react';
//定义组件属性的接口(用来实现强类型)
interface ButtonProps {
increment: number,
onClickFunction: React.Dispatch<number>
}
interface DisplayProps {
message: number
using System;
using Microsoft.Identity.Client;
using Microsoft.Graph;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace graphserviceapp
{
class Program
{
@chenxizhang
chenxizhang / graph-application-permission-msal3.cs
Created June 3, 2019 08:27
use client credential flow to authentication and invoke graph request
using System;
using Microsoft.Identity.Client;
using Microsoft.Graph;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace graphserviceapp
{
class Program
{
@chenxizhang
chenxizhang / Graphsamplecode.cs
Created April 10, 2019 07:41
Graph sample code for MSAL
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Graph;
using Microsoft.Identity.Client;
namespace testconsole
{
class GraphAuthenticator : IAuthenticationProvider