Skip to content

Instantly share code, notes, and snippets.

View MarioBinder's full-sized avatar
:octocat:
.

Mario Binder MarioBinder

:octocat:
.
View GitHub Profile
@MarioBinder
MarioBinder / Program.cs
Created October 29, 2021 08:59
PriorityQueue Example
var tvShows = new PriorityQueue<string, ShowRating>();
tvShows.Enqueue("Modern Family", ShowRating.Good);
tvShows.Enqueue("Ted Lasso", ShowRating.Amazing);
tvShows.Enqueue("MasterChef", ShowRating.Good);
tvShows.Enqueue("Breaking Bad", ShowRating.Transcendant);
tvShows.Enqueue("Happy Endings", ShowRating.Amazing);
tvShows.Enqueue("Game of Thrones (Seasons 1-6)", ShowRating.Amazing);
tvShows.Enqueue("Game of Thrones (Seasons 7-8)", ShowRating.OK);
tvShows.Enqueue("How to Get Away with Murder", ShowRating.Good);
@MarioBinder
MarioBinder / gist:6550a30a026d30a09890b3edd5df1a32
Last active July 19, 2021 06:33
stash current work into new branch #git #stash #branch
git stash
git stash branch <new-branch> stash@{0}
If the other branch already exists, you can just switch to it with checkout, then git stash apply
//via https://stackoverflow.com/a/30927991/119109
@MarioBinder
MarioBinder / git delete remote branch
Created June 23, 2021 09:16
git delete remote branch
git push origin --delete feature/login
install homebrew on linux:
https://brew.sh/
brew install gh
gh auth login # Follow steps.
gh gist create myfile.txt # Creates a private gist.
gh core commands
gist: Manage gists
@MarioBinder
MarioBinder / helloworld.cpp
Last active April 14, 2021 19:08
install_cplusplus_linux
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
@MarioBinder
MarioBinder / chello.c
Last active April 14, 2021 18:49
C++ with VSCode
#include<stdio.h>
int main() {
printf("Hello Mario C World from VS Code and the C/C++ extension!\n");
return 0;
}
@MarioBinder
MarioBinder / README-Template.md
Created March 3, 2021 12:06 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@MarioBinder
MarioBinder / snippet.js
Created August 21, 2020 08:00
bootstrap 4 - save active tab
$('a[data-toggle="tab"]').on('show.bs.tab', function(e) {
localStorage.setItem('activeTab', $(e.target).attr('href'));
});
var activeTab = localStorage.getItem('activeTab');
if(activeTab){
$('#myTab a[href="' + activeTab + '"]').tab('show');
}
@MarioBinder
MarioBinder / grantaccess.cs
Created August 18, 2020 13:26
grant access to database from entity framework
var sql = "USE <DBNAME>;" +
"create user [domain\\user] from login [domain\\user];" +
"ALTER ROLE db_datareader ADD MEMBER [domain\\user] ;";
try
{
using (var ctx = new MyContext())
{
Info($"Start Grant Acess to xx: {DateTime.Now}");
ctx.Database.ExecuteSqlCommand(sql);
@MarioBinder
MarioBinder / killl.sql
Last active August 18, 2020 13:24
kill database process by dbname
DECLARE @SQL varchar(max)
SELECT @SQL = COALESCE(@SQL,'') + 'kill ' + Convert(varchar, SPId) + ';'
FROM MASTER..SysProcesses
WHERE DBId = DB_ID(<DBNAME>) AND SPId <> @@SPId
--SELECT @SQL
--EXEC(@SQL)