Skip to content

Instantly share code, notes, and snippets.

View Orbis25's full-sized avatar
🚀
Working

Orbis Alonzo Gutierrez Orbis25

🚀
Working
View GitHub Profile
@Orbis25
Orbis25 / test.json
Created February 12, 2024 21:27
test
{
"data": [
{
"id": 1,
"name": "china"
}
]
}
@Orbis25
Orbis25 / fullname.cs
Created July 3, 2023 15:21
full name c# code
public static string ToFullName(string? name, string? secoundName, string? lastName, string? secoundLastName)
{
string _name = string.IsNullOrEmpty(name) ? "" : $"{name.Trim()[0].ToString().ToUpper()}{name[1..]}";
string _secoundName = string.IsNullOrEmpty(secoundName) ? "" : $"{secoundName.Trim()[0].ToString().ToUpper()}{secoundName[1..]}";
string _lastName = string.IsNullOrEmpty(lastName) ? "" : $"{lastName.Trim()[0].ToString().ToUpper()}{lastName[1..]}";
string _secoundLastName = string.IsNullOrEmpty(secoundLastName) ? "" : $"{secoundLastName.Trim()[0].ToString().ToUpper()}{secoundLastName[1..]}";
return $"{_name}{(string.IsNullOrEmpty(secoundName?.Trim()) ? " " : $" {_secoundName} ")}{_lastName}{(string.IsNullOrEmpty(secoundLastName?.Trim()) ? "" : $" {_secoundLastName}")}";
}
@Orbis25
Orbis25 / validateCreditCard.cs
Last active June 29, 2023 21:15
Validate creditcard with c#
private static bool ValidateCreditCard(string? creditCard)
{
try
{
_ = long.Parse(creditCard ?? "");
}
catch (Exception)
{
return false;
@Orbis25
Orbis25 / auto-increment-code.sql
Created March 23, 2023 20:22
Generate a unique code in sql autoincrement
CREATE TABLE [TABLE_NAME](
Id UNIQUEIDENTIFIER PRIMARY KEY NOT NULL,
[Index] INT IDENTITY(1,1) NOT NULL,
[Code] AS ('P'+ RIGHT('00000' + CAST(([Index]) AS VARCHAR(5)), 5)) PERSISTED,
)
@Orbis25
Orbis25 / regex-utilities.js
Created October 5, 2022 13:09
List of regex used or common used
/*
* Regex for validate email
*/
const emailValidator = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
@Orbis25
Orbis25 / firebase.helpers.ts
Created July 7, 2021 01:09
firebase helpers
import { BaseModel } from "../../base/models/base.model";
import firebase from "firebase";
/**
* format all properties timestamp firebase to DateJs
* @author Orbis Alonzo Gutierrez
* @param data any
* @returns T Object
*/
const getFormatedFirebaseData = <T>(data: any) => {
@Orbis25
Orbis25 / TableComponent.tsx
Last active January 2, 2023 16:48
Generic table in reactjs + typescript
import { Table } from "react-bootstrap";
import "./styles.css";
type Props = {
headers: string[];
data: any[];
showId?: boolean;
handleClick: (id: string | undefined) => void;
};
@Orbis25
Orbis25 / RepositoryBase.ts
Created June 25, 2021 18:02
Generic repository with firebase
import firebase from "firebase";
import { firebaseConfiguration } from "../../firebase";
import { BaseModel } from "../models/base.model";
import { PaginationBaseModel } from "../models/pagination-base.model";
interface IRepositoryBase<TEntity extends BaseModel> {
create(model: TEntity): Promise<TEntity>;
update(model: TEntity): Promise<TEntity>;
/**
* exec a softdelete
@Orbis25
Orbis25 / cities.json
Last active July 20, 2023 04:47
Constains the cities and nationalties json
This file has been truncated, but you can view the full file.
[
{
"country": "AD",
"name": "Sant Julià de Lòria",
"lat": "42.46372",
"lng": "1.49129"
},
{
"country": "AD",
"name": "Pas de la Casa",
@Orbis25
Orbis25 / index.js
Created May 5, 2021 18:35
Load partials view generics
var LoadPartialView = async (contentId, url) => {
const content = $(`#${contentId}`);
content.empty();
content.append("cargando...");
try {
const result = await fetch(url, { method: "GET" });
content.empty();
if (result.status === 200) {
content.append(await result.text());
} else if (result.status === 400) {