Skip to content

Instantly share code, notes, and snippets.

View chenxizhang's full-sized avatar
🎯
Focusing

chenxizhang chenxizhang

🎯
Focusing
View GitHub Profile
@chenxizhang
chenxizhang / Program.cs
Last active September 17, 2017 01:35
ASP.NET Core的基本写法,自定义端口号
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace web
{
public class Program
@chenxizhang
chenxizhang / WebClientWithCookie.cs
Created September 17, 2017 01:29
自定义支持Cookie的WebClient
/// <summary>
/// 自定义的WebClient,支持Cookie,在多个请求之间可以重复利用
/// 作者:陈希章
/// 邮箱:ares@xizhang.com
/// 时间:2017年9月17日
/// </summary>
public class WebClientWithCookie : WebClient
{
/// <summary>
/// 默认构造器,创建一个空白的CookieContainer
@chenxizhang
chenxizhang / MicrosoftGraph-ConsoleApplication.cs
Created November 13, 2017 13:39
这个范例代码演示了如何在Console Application中完整地实现Azure AD 2.0身份认证,并且保存身份。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Identity.Client;
using Microsoft.Graph;
using System.Net.Http;
/// <summary>
@chenxizhang
chenxizhang / report generator vsto csharp.cs
Created November 24, 2017 23:49
Report generator VSTO Csharp Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Microsoft.Office.Interop.Excel;
namespace ExcelAddIn3
{
public partial class Ribbon1
@chenxizhang
chenxizhang / Report generator vsto vb.vb
Created November 24, 2017 23:50
Report generator VSTO VB Sample
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Tools.Ribbon
Public Class Ribbon1
Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As RibbonControlEventArgs) Handles Button1.Click
@chenxizhang
chenxizhang / Report generator vba.vb
Last active February 15, 2019 11:58
Report Generator VBA Sample
Sub ReportGeneration()
' 这个方法用来生成销售数据,并且基于这些数据生成一个柱状图表
' 作者:陈希章
Dim sh As Worksheet
Set sh = ThisWorkbook.Worksheets.Add
sh.Activate
Dim rng As Range
name: GetAPIValues
description: ''
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Excel.run(async (context) => {
@chenxizhang
chenxizhang / SUMMARY.md
Created December 16, 2017 07:08
access azure cognitive service emotion api via image url
@chenxizhang
chenxizhang / micrsoftgraphsdkwithadal.cs
Created March 15, 2018 06:45
Connect to Microsoft Graph use ADAL & Microsoft Graph SDK
using Microsoft.Graph;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Threading.Tasks;
namespace MicrosoftGraphSampleUseADAL
{
//这个代码演示了如何使用ADAL和Microsoft Graph库来实现访问,并且分别实现了国际版和国内版
//作者:陈希章
@chenxizhang
chenxizhang / YouImage.EXCEL.yaml
Last active March 13, 2019 09:49
Create a new snippet from a blank template.
name: YouImage
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
var dec2hex = function(d) {
if (d > 15) {