Skip to content

Instantly share code, notes, and snippets.

View shrikantgond's full-sized avatar
🏠
Working from home

Shrikant Gond shrikantgond

🏠
Working from home
View GitHub Profile
@shrikantgond
shrikantgond / app.js
Created June 16, 2020 08:47 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
@shrikantgond
shrikantgond / CreateGuid.ts
Created May 12, 2020 12:17 — forked from benjamincharity/CreateGuid.ts
A TypeScript class that generates a guid
// http://stackoverflow.com/questions/26501688/a-typescript-guid-class
class Guid {
static newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : ( r & 0x3 | 0x8 );
return v.toString(16);
});
}
}
@shrikantgond
shrikantgond / Guid.ts
Created May 12, 2020 12:17 — forked from emptyother/Guid.ts
GUID class for Typescript
class Guid {
public static newGuid(): Guid {
return new Guid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = (c == 'x') ? r : (r & 0x3 | 0x8);
return v.toString(16);
}));
}
public static get empty(): string {
return '00000000-0000-0000-0000-000000000000';
@shrikantgond
shrikantgond / any.component.html
Created May 1, 2020 04:45 — forked from arniebradfo/any.component.html
Angular *ngFor recursive list tree template
<h1>Angular 2 Recursive List</h1>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let item of list">
{{item.title}}
<ul *ngIf="item.children.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container>
</ul>
</li>
</ng-template>
@shrikantgond
shrikantgond / githubClient.cs
Created March 29, 2020 10:17 — forked from EvanSnapp/githubClient.cs
C# use the github api to read files out of a directory
namespace GithubClient
{
//JSON parsing methods
struct LinkFields {
public String self;
}
struct FileInfo{
public String name;
public String type;
public String download_url;
@shrikantgond
shrikantgond / postman_test.js
Last active July 27, 2018 12:00
Json Schema in Postman
// Define the JSON Schema
const customerSchema = {
"required": ["id"],
"properties": {
"id": {
"type": "integer",
"minimum": 100,
"maximum": 1000
},
"name": {