Skip to content

Instantly share code, notes, and snippets.

View angular reactive form with angular material and autocomplete
<div [formGroup]="userFormGroup">
<div class="row" formGroupName="userGroup">
<div class="userinfo col-md-6">
<mat-form-field [floatLabel]="'always'">
<input matInput class="domainPrefixValidate" formControlName="prefixField" (blur)="checkPrefix()" placeholder="DOMAIN PREFIX" required>
<span matSuffix></span>
<mat-form-field [floatLabel]="'always'">
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 send email function
public bool SendEmail(string from, string to, string subject, string message, string cc = null, string bcc = null, bool isHTML = false, List<Attachment> attachments = null, string fromAddressDisplayName = "", string sendingApplication = "Email Service Application")
bool isSent = false;
// subject QA/LIVE
if (Global.IsTestMode)
if (Global.IsAU())
subject = "QA:AU - " + subject;
View how to remove account
I was able to fix the issues by deleting the files in ~Library/Accounts/ and ~/Library/Preferences/MobileMeAccounts.plist
then logging out and in again before opening the panels again.
Warning: This also removes every other account you have listed in the accounts folder.
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)
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 text box with an arrow
.widget-text {
background-color: #999590;
color: white;
margin: 10px 0 0 70px;
padding: 1px 20px;
position: relative;
.widget-text:before, .widget-text:after {
content: "";
View autocomplete
$.fn.showPostcodeAutoComplete = function (pcode) {
source: function (request, response) {
url: 'api/checkout/GetPostCodeList',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(pcode),
dataType: 'json',
View angular Reactive form
<div [formGroup]="addressFormGroup">
<div formGroupName="addressGroup">
<mat-form-field [floatLabel]="'always'">
<input matInput formControlName="companyName" placeholder="Company Name" (blur)="isNotValidField('addressGroup.companyName', account_validation_messages.companyName)"/>
<mat-checkbox [(ngModel)]="collectTheOrder" formControlName="collectTheOrder" style="display: block;margin-left: 18px;">
I will collect this order
View covert EpochTime to Datetime and covert Datetime to EpochTime
/// <summary>
/// Converts the given date value to epoch time.
/// </summary>
public static long ToEpochTime(this DateTime dateTime)
var date = dateTime.ToUniversalTime();
var ticks = date.Ticks - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
var ts = ticks / TimeSpan.TicksPerSecond;
return ts;
You can’t perform that action at this time.