Skip to content

Instantly share code, notes, and snippets.

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

Dave Roman MrDave1999

🏠
Working from home
View GitHub Profile
@MrDave1999
MrDave1999 / nodejs-cicd-github-actions.md
Created March 31, 2024 03:39 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@MrDave1999
MrDave1999 / Dockerfile
Created November 13, 2023 19:35 — forked from endofcake/Dockerfile
Copy *.csproj files during a docker build, preserving the directory structure (kudos to @aidansteele)
COPY src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done
@MrDave1999
MrDave1999 / Result.cs
Created September 7, 2023 15:11 — forked from m-jovanovic/Result.cs
Result type
public class Result
{
protected internal Result(bool isSuccess, Error error)
{
if (isSuccess && error != Error.None)
{
throw new InvalidOperationException();
}
if (!isSuccess && error == Error.None)
@MrDave1999
MrDave1999 / LongestCommonPrefix.cs
Last active April 14, 2022 02:57
Longest Common Prefix
/*
https://leetcode.com/problems/longest-common-prefix/
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
@MrDave1999
MrDave1999 / strcopy.c
Last active December 14, 2021 15:00
Implementing a strcpy so that you can copy multiple strings.
#include <stdio.h>
#include <stdarg.h>
#define STRCOPY(destination, num, ...) strcopy(destination, num, __VA_ARGS__, NULL)
char* strcopy(char*, size_t, ...);
int main(void)
{
char dest[10 + 1];
printf("%s\n", STRCOPY(dest, sizeof dest, "Hello", "World"));
@MrDave1999
MrDave1999 / GameMode.cs
Last active October 22, 2021 21:40
Example on the use of event keyword in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExampleEvent
{
public class PlayerConnectedEventArgs : EventArgs
{
@MrDave1999
MrDave1999 / convert.cs
Created June 18, 2021 00:39
RawData to CreateObject Converter for SA-MP
using System;
using System.IO;
class Program
{
static void Main(string[] args)
{
string[] files = Directory.GetFiles("rawdata");
foreach(string file in files)
{
@MrDave1999
MrDave1999 / DateTime.vue
Last active May 21, 2021 02:53
(VueJS) Componente input-datetime personalizado
<template>
<input type="datetime-local" v-bind:value="decode" v-on:input="encode" />
</template>
<script>
export default {
name: 'DateTime',
props:{
value: String
@MrDave1999
MrDave1999 / GIT.md
Last active April 23, 2021 15:00 — forked from dasdo/GIT.md
Lista de Comandos en GIT

Configuración Básica

Configurar Nombre que salen en los commits

	git config --global user.name "dasdo"

Configurar Email

	git config --global user.email dasdo1@gmail.com
@MrDave1999
MrDave1999 / histograma_vertical.c
Last active February 24, 2021 18:51
Algoritmo básico para imprimir un histograma de forma vertical.
#include <stdio.h>
int main(void)
{
int array[] = {1, 5, 8, 0, 12, 13, 1, 2, 10, 7};
int len = sizeof array / sizeof *array;
const int mayor = array[5];
for(int line_current = 1; line_current <= mayor; ++line_current)
{
for(int j = 0; j < len; ++j)