Skip to content

Instantly share code, notes, and snippets.

View sudharsan203's full-sized avatar

Venkata Sudharsan Reddy sudharsan203

View GitHub Profile
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
<mat-option *ngIf="isLoading" class="is-loading"><mat-spinner diameter="50"></mat-spinner></mat-option>
<ng-container *ngIf="!isLoading">
<mat-option *ngFor="let user of filteredUsers" [value]="user">
<span>{{ user.name }}</span>
<small> | ID: {{user.id}}</small>
</mat-option>
</ng-container>
</mat-autocomplete>
@sudharsan203
sudharsan203 / email_dreamcode.js
Created July 18, 2019 09:34 — forked from gr2m/email_dreamcode.js
Imagine you could send emails with JavaScript, multipart, and with attachments?! How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// send text email
sendEmail({
subject: "Hello, World!",
text: "This mail has been sent from the frontend",
to: "joe@exam.pl"
})
// send multipart text / html email
sendEmail({
subject: "Hello, World!",
@sudharsan203
sudharsan203 / gist:07d17ec05aeeee8544a19610486f2c6f
Created March 29, 2019 08:46 — forked from niteshpsit1/gist:c90b3336ee639c89ae13b98825c9d9ca
Sorting an array order by frequency of occurence in javascript
/**
* Sorting an array order by frequency of occurence in javascript
* @param {array} array An array to sort
* @returns {array} array of item order by frequency
**/
function sortByFrequency(array) {
var frequency = {};
var sortAble = [];
var newArr = [];