Skip to content

Instantly share code, notes, and snippets.

Zhen Deng ZhenDeng

Block or report user

Report or block ZhenDeng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Website loading remind
1. add html below in <app-root></app-root> or in index.html
<div id="pre-bootstrap">
<div class="messaging">
Website is Loading
<div class="app-loader">
<div class="app-loader-inner">
View use urlHelper in .net core
in startup.cs
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
services.AddScoped<IUrlHelper>(x => {
var actionContext = x.GetRequiredService<IActionContextAccessor>().ActionContext;
var factory = x.GetRequiredService<IUrlHelperFactory>();
return factory.GetUrlHelper(actionContext);
then could inject IUrlHelper
View Get value from appsettings.json
private readonly IConfiguration _configuration;
public Tools(IConfiguration configuration)
_configuration = configuration;
public string GetConfigKey(string categoryName, string keyName)
string keyValue = null;
View .net core
1. Go to appsettings.json file and add the secret key for the JWT encryption.
"AppSettings": {
2. Create a class as “AppSettings.cs” to access the AppSetting values trough a class.
namespace NetCoreWebAPI.Helpers
View angular powered bootstrap tooltip
1. top arrow fix
:host ::ng-deep .arrow::before {
border-top-color: #C0054D;
border-bottom-color: white !important;
:host ::ng-deep .tooltip-inner {
background: #C0054D;
width: 200px;
View export data to excel
using (ExcelPackage pck = new ExcelPackage())
TenantsDetailsSheet(pck, tenantList.Output);
private ExcelPackage TenantsDetailsSheet(ExcelPackage pck, List<GetCSPTenant.Out> annuityList)
var input = new GetCSPSubscription.In();
input.in_status = "A";
input.in_update_status = "N";
View manipulate dropdown list and checkbox
***** Always select last one ,when add a new one, this list will select new one automatically *****
<label>Summary: </label>
<select (change)="filterForeCasts($event.value)">
<option *ngFor="let summary of summaries" [value]="summary" [selected]="summary == summaries[summaries.length-1]">
View Ajax sample
url: '/Account/Login',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(loginInfo),
dataType: 'json',
success: function (output) {
if (output.Status == 'fail') {
View call Restful api
public enum WebMethods
public static T GetJsonResult<T>(string baseUrl, WebMethods method, dynamic queryParameters = null, dynamic bodyContent = null, dynamic token = null) where T : new()
string url = string.Empty;
if (queryParameters != null)
You can’t perform that action at this time.