Skip to content

Instantly share code, notes, and snippets.

View ransagy's full-sized avatar

Ran Sagy ransagy

  • WSC Sports
  • Israel
View GitHub Profile
@ErikEJ
ErikEJ / IQueryableExtensions.cs
Last active February 29, 2024 12:16
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
using System.Linq.Expressions;
namespace Microsoft.EntityFrameworkCore
{
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)
@SQL-MisterMagoo
SQL-MisterMagoo / index.html
Last active March 19, 2020 19:30
Monitor Blazor WASM loading and report errors
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Blazor Loading</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
</head>
@EdCharbeneau
EdCharbeneau / Templates.cshtml
Last active February 25, 2019 22:19
Row Template Detail
@page "/grid/templates"
@using TelerikBlazor.App.Models
@inject NorthwindContext nwContext
<h4> Row Template </h4>
<KendoGrid Data=@GridData Height="@Height">
<RowTemplate Context="product">
@if (selectedId == product.ProductId)
<#
.SYNOPSIS
Retries a powershell command n-times.
.DESCRIPTION
The cmdlet is capable of retrying a PowerShell command passed as a [ScriptBlock] according to the user defined number of retries and timeout (In Seconds)
.PARAMETER TimeoutInSecs
Timeout in secods for each retry.
@Wanchai
Wanchai / .gitlab-ci.yml
Last active September 20, 2020 21:41
Deploy an app from Gitlab registry to Heroku (.Net Core example). See -> http://blog.thomasmalicet.com/2018/04/deploy-app-from-gitlabs-registry-to.html
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
# You can find this on your Gitlab repo page, under "Registry"
CONTAINER_GITLAB: registry.gitlab.com/<USER OR GROUP NAME>/<REPO NAME>
# It's just a tag, use whatever you want : back, front, test, staging...
CONTAINER_TAG: latest
@Ahmed-Abdelhameed
Ahmed-Abdelhameed / DelayFadeOutSampleProvider.cs
Last active June 7, 2022 06:19 — forked from markheath/DelayFadeOutSampleProvider.cs
NAudio basic example of how to begin a fade out after a certain number of milliseconds have elapsed
// Define other methods and classes here
/// <summary>
/// Sample Provider to allow fading in and out
/// </summary>
public class DelayFadeOutSampleProvider : ISampleProvider
{
enum FadeState
{
Silence,
FadingIn,
@joncloud
joncloud / pr.md
Last active April 10, 2021 07:35
Checkout vsts pull requests locally

Forked from piscisaureus

Locate the section for your vsts remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = ssh://my-vsts@my-vsts.visualstudio.com:22/DefaultCollection/Project-Name/_git/Repo-Name
@solendil
solendil / logger.js
Last active February 10, 2022 18:57
A simple Javascript logger with modules and levels that preserves line numbers
/*
* Copyright 2016, Matthieu Dumas
* This work is licensed under the Creative Commons Attribution 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/
*/
/* Usage :
* var log = Logger.get("myModule") // .level(Logger.ALL) implicit
* log.info("always a string as first argument", then, other, stuff)
* log.level(Logger.WARN) // or ALL, DEBUG, INFO, WARN, ERROR, OFF
@Jargon64
Jargon64 / RSACryptoServiceProviderExtensions.cs
Last active November 29, 2021 02:11
RSACryptoServiceProvider Extension to add FromXmlString and ToXmlString methods for ASP.NET Core
using System;
using System.Security.Cryptography;
using System.Xml;
namespace RSACryptoServiceProviderExtensions
{
public static class RSACryptoServiceProviderExtensions
{
public static void FromXmlString(this RSACryptoServiceProvider rsa, string xmlString)
{
@willurd
willurd / web-servers.md
Last active April 23, 2024 04:35
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000