Skip to content

Instantly share code, notes, and snippets.

View NDiiong's full-sized avatar
😀
Hi there!

duong.nb NDiiong

😀
Hi there!
View GitHub Profile
// Cronicle Auto Installer
// Copyright (c) 2015 - 2023 Joseph Huckaby, MIT License.
// https://github.com/jhuckaby/Cronicle
// To install, issue this command as root:
// curl -s "https://raw.githubusercontent.com/jhuckaby/Cronicle/master/bin/install.js" | node
var path = require('path');
var fs = require('fs');
var util = require('util');
@NDiiong
NDiiong / HelloHeels
Created October 26, 2022 04:21 — forked from MayaReneeD/HelloHeels
Hello Heels
Hello Heels is an application that allows the user to search and snag the perfect pair of heels straight from independent vendors based on their own unique style.
API Key for Esty: hwox3uujwstcvm3eibnbf9rf
@echo off
setlocal EnableDelayedExpansion
for /r E:\repos\ %%f in (*.gitignore) do (
ECHO repository: %%~dpf
cd %%~dpf
call git fetch
call git pull
)
<!-- CSS -->
<link href="https://vjs.zencdn.net/7.2.3/video-js.css" rel="stylesheet">
<!-- HTML -->
<video id='vtv6' class="video-js vjs-default-skin" width="400" height="300" controls>
<source type="application/x-mpegURL" src="https://vips-livecdn.fptplay.net/hda1/vtv6hd_vhls.smil/chunklist_b5000000.m3u8">
</video>
@NDiiong
NDiiong / TaskExtensions.cs
Created April 25, 2022 06:53 — forked from gongdo/TaskExtensions.cs
Task extensions for parallelism
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Gist
{
public static class TaskExtensions
{
@NDiiong
NDiiong / CustomerController.cs
Created April 19, 2022 03:13 — forked from vkhorikov/CustomerController.cs
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Net.Http.Headers;
using System.Threading.Tasks;
namespace ActionResults;
public class FileActionResult : IActionResult
{
private readonly byte[] _contentFile;
public class BaseSpecification<T> : ISpecification<T>
{
public BaseSpecification()
{
}
public BaseSpecification(Expression<Func<T, bool>> criteria)
{
Criteria = criteria;
}
@NDiiong
NDiiong / IUnitOfWork.cs
Created June 10, 2021 11:12
UnitOfWork
public interface IUnitOfWork
{
IRepository<TEntity, TKey> GetRepository<TEntity, TKey>(Type repository = null) where TEntity : class, IEntity<TKey>, new() where TKey : IEquatable<TKey>;
void Save();
Task SaveAsync();
void Dispose();
@NDiiong
NDiiong / DataTemplate.cs
Last active June 2, 2021 02:14
Pattern Builder
public enum PdfPageSize
{
A0,
A1,
A2,
A3,
A4
}
public class DocumentPreferencesBuilder