Skip to content

Instantly share code, notes, and snippets.

View rodrigoramirez93's full-sized avatar
🧉

Rodrigo rodrigoramirez93

🧉
View GitHub Profile
@rodrigoramirez93
rodrigoramirez93 / gist:d3dd827c861146f5b696c739fc238f65
Created March 24, 2022 03:23
React default.conf dockerfile line replace
//Related: coderrocketfuel.com/article/fix-404-error-when-using-react-rouder-dom-and-nginx
FROM nginx:stable-alpine
COPY --from=build /app/build /usr/share/nginx/html
>>>>>>>RUN sed -i 's/index index.html index.htm/try_files $uri \/index.html/g' /etc/nginx/conf.d/default.conf
EXPOSE 80
@rodrigoramirez93
rodrigoramirez93 / DatabaseContextHelper.cs
Last active May 9, 2020 19:16
Delete all data from every table in database except table "__EFMigrationsHistory"
//this methods aims to be used on a testing database. It's extremely harmful, proceed with caution
public static class DatabaseContextHelper
{
public static readonly string DisableTablesConstraintsCommand = "EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' ";
public static readonly string DeleteAllTablesDataExceptMigrationsTableCommand = "EXEC sp_MSforeachtable 'if (\"?\" NOT IN (\"[dbo].[__EFMigrationsHistory]\")) DELETE FROM ?'";
public static readonly string EnableTablesConstraintsCommand = "EXEC sp_MSForEachTable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL'";
public static void DeleteAllDataExceptMigrations(this DbContext context)
{
@rodrigoramirez93
rodrigoramirez93 / script.js
Last active May 9, 2020 12:31
Change color randomly in javascript
//live example at: https://playcode.io/448394
var makeColors = () => {
var minNum = 0;
var maxNum = 9;
var minLet = 65;
var maxLet = 71;
function randomNumber() {
@rodrigoramirez93
rodrigoramirez93 / Compare the triplets c#.cs
Created May 19, 2017 14:47
Compare the triplets @ HackerRank // C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution
{
static int[] solve(int a0, int a1, int a2, int b0, int b1, int b2)
{
int[] tripletAlice = { a0, a1, a2 };