Skip to content

Instantly share code, notes, and snippets.

@rneto
rneto / base.css
Created September 8, 2023 10:59
Base CSS styles.
/* Base styles */
*,
::after,
::before {
box-sizing: border-box;
}
html,
body {
@rneto
rneto / EmailSender.cs
Last active April 24, 2023 13:08
ASP.NET Core Identity IEmailSender interface implementation
// ## appsettings.json
// {
// "blablabla": "*",
// "Smtp": {
// "Host": "smtp.host.com",
// "Port": "587",
// "EnableSsl": true,
// "Username": "user@name.com",
// "Password": "password1"
// }
@rneto
rneto / util.ts
Last active October 31, 2022 07:12
Util TypeScript module for my Angular apps.
/**
* Make this a module.
*/
export {};
/**
* Access the global types
*/
declare global {
/**
@rneto
rneto / auth.service.ts
Last active August 17, 2021 14:17
Authentication service preserving + (plus sign) in URLEncoded HTTP POST Request
// src/environments/environment.ts
//
// const url = 'http://localhost:12345/';
// export const environment = {
// authUrl: url + 'oauth/token',
// };
// ../utils/httpUrlEncodingCodec.ts
//
// import {HttpParameterCodec} from "@angular/common/http";
getCurrentScriptURLParam = (name: string) => {
const script = document.currentScript as HTMLScriptElement || document.querySelector('script[src*="script-name.js"]');
let value: string | null = '';
if (script?.src) {
const url = new URL(script?.src);
value = url.searchParams.get(name);
}
return value ?? '';
}
using System.Text.Json;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
namespace Presentation.Common
{
/// <summary>
/// Temp data extension class.
/// </summary>
public static class TempDataExtension
{
@rneto
rneto / Result.cs
Last active August 17, 2021 14:18
using FluentValidation.Results;
namespace Application.Models
{
/// <summary>
/// Service result content.
/// </summary>
/// <typeparam name="T">Result data type.</typeparam>
public class Result<T>
{
@rneto
rneto / vue-vuetify-vue-i18n-interface.d.ts
Created June 13, 2020 06:07
Merge Vuetify and VueI18n in a new Vue interface type for TypeScript
import { Vuetify, Framework } from 'vuetify/types';
import VueI18n, { IVueI18n } from 'vue-i18n/types';
declare module 'vue/types/vue' {
interface Vue {
$vuetify: Framework;
readonly $i18n: VueI18n & IVueI18n;
$t: typeof VueI18n.prototype.t;
$tc: typeof VueI18n.prototype.tc;
$te: typeof VueI18n.prototype.te;
import { TextUtil } from '../utils'
import { Result, Guard } from '../../core'
interface UserEmailProps {
email: string;
}
export class UserEmail extends ValueObject<UserEmailProps> {
// Private constructor. No one can say "new UserEmail('diddle')"
// user/services/userService.ts
interface User {
userId: string;
email: string;
firstName: string;
lastName: string;
}
interface IUserService {
getUserByUserId (userId: string): Promise<User>;