Skip to content

Instantly share code, notes, and snippets.

View rodrigoramirez93's full-sized avatar

Rodrigo rodrigoramirez93

View GitHub Profile
rodrigoramirez93 / gist:d3dd827c861146f5b696c739fc238f65
Created March 24, 2022 03:23
React default.conf dockerfile line replace
View gist:d3dd827c861146f5b696c739fc238f65
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
rodrigoramirez93 / DatabaseContextHelper.cs
Last active May 9, 2020 19:16
Delete all data from every table in database except table "__EFMigrationsHistory"
View DatabaseContextHelper.cs
//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 / script.js
Last active May 9, 2020 12:31
Change color randomly in javascript
View script.js
//live example at:
var makeColors = () => {
var minNum = 0;
var maxNum = 9;
var minLet = 65;
var maxLet = 71;
function randomNumber() {
rodrigoramirez93 / Compare the triplets c#.cs
Created May 19, 2017 14:47
Compare the triplets @ HackerRank // C#
View Compare the triplets c#.cs
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 };