Skip to content

Instantly share code, notes, and snippets.

View swedishkid's full-sized avatar

Kasper Eklander swedishkid

  • Copenhagen, Denmark
View GitHub Profile
@luisquintanilla
luisquintanilla / MLNET-ASPNETInteractive.ipynb
Created April 23, 2021 02:57
ASP.NET Interactive Extension + ML.NET
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using System;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Components
{
public class SectionContent : IComponent, IDisposable
{
private SectionRegistry _registry;
[Parameter] public string Name { get; set; }
@SQL-MisterMagoo
SQL-MisterMagoo / App.razor
Created December 29, 2019 00:33
Sample code to handle deep links to anchors in Blazor components
@* Code below handles deep links to anchors through the entire application *@
@inject NavigationManager NavMan
@inject IJSRuntime JS
@code
{
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && NavMan.Uri.Contains('#'))
{
@slorber
slorber / react-navigation-tree.jsx
Last active August 13, 2022 19:17
react-navigation-tree.jsx
const App = createAppContainer(
createStack({
LoggedSwitch: createSwitch({
// When user is authenticated
LoggedIn: createStack({
// The logged in root is generally a tab or drawer navigator
LoggedInRoot: createTabsOrDrawer({
@mfellner
mfellner / graphql.ts
Created July 8, 2019 20:42
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
}
`;
const resolvers = {
Query: {
@clarkdave
clarkdave / createPages.ts
Created April 15, 2018 13:11
TypeScript + Gatsby node API
import { resolve } from 'path'
import { GatsbyCreatePages } from './types'
const createPages: GatsbyCreatePages = async ({
graphql,
boundActionCreators,
}) => {
const { createPage } = boundActionCreators
const allMarkdown = await graphql(`
@duluca
duluca / npm-scripts-for-docker.md
Last active July 22, 2024 08:54
npm scripts for Docker

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

How to Use

npm i -g mrm-task-npm-docker
npx mrm npm-docker

Contribute

Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker

Write-Host "Installing RabbitMQ..." -ForegroundColor Cyan
Write-Host "Downloading..."
$exePath = "$($env:USERPROFILE)\rabbitmq-server-3.5.4.exe"
(New-Object Net.WebClient).DownloadFile('http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.4/rabbitmq-server-3.5.4.exe', $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /S
$rabbitPath = 'C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.5.4'
@mattupstate
mattupstate / put-s3-bucket-notification-configuration
Last active January 11, 2022 03:31
Example of how to configure S3 bucket notifications from the command line
#!/usr/bin/env python
import argparse
import sys
try:
import boto3
except ImportError:
print('Please install boto3 to use this tool')
sys.exit(1)
@mikeminutillo
mikeminutillo / ProjectDependencies.cs
Created June 12, 2015 01:25
Get project dependency graph out using yuml.me and LINQPad
void Main()
{
var ignores = new Regex[]
{
new Regex(@"Approval"),
new Regex(@"Test"),
new Regex(@"Demo")
};
var serviceControl = @"C:\Code\Particular\ServiceControl\src\";
Util.Image("http://yuml.me/diagram/scruffy;scale:150/class/" + String.Join(",", GetDependencies(serviceControl, ignores))).Dump();