Skip to content

Instantly share code, notes, and snippets.

View Martin-Andersen's full-sized avatar

Martin H. Andersen Martin-Andersen

View GitHub Profile
@Martin-Andersen
Martin-Andersen / CertificateToApproveHubStore.cs
Last active February 23, 2023 15:55
Fluxor for a SignalR hub
using Fluxor;
using Ibex.Shared.DTO;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.SignalR.Client;
namespace Ibex.Client.Store;
public record CertificateToApproveState
{
public CertificateToApproveState()
@Martin-Andersen
Martin-Andersen / httpStore.js
Created June 5, 2022 14:00 — forked from joshnuss/httpStore.js
A Svelte store backed by HTTP
import { writable } from 'svelte/store'
// returns a store with HTTP access functions for get, post, patch, delete
// anytime an HTTP request is made, the store is updated and all subscribers are notified.
export default function(initial) {
// create the underlying store
const store = writable(initial)
// define a request function that will do `fetch` and update store when request finishes
store.request = async (method, url, params=null) => {

Secrets

kubectl get secrets
kubectl get secrets/db-inv-external-reader --template='{{.data.password | base64decode}}'

Run commands in a pod

kubectl exec --stdin --tty swiss-army-knife-57bd8544b6-wwjd2 -- /bin/bash

@Martin-Andersen
Martin-Andersen / Gulpfile.js
Created February 12, 2018 09:51
Gulp getting started file for scss compilation and browsersync
// https://www.sitepoint.com/simple-gulpy-workflow-sass/
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var flatten = require('gulp-flatten')
var bs = require('browser-sync').create(); // create a browser sync instance.
var input_scss = './03/**/*.scss';
var input_html = './03/**/*.html';
@Martin-Andersen
Martin-Andersen / Responsive Design Testing.html
Created March 19, 2017 10:29
Minify the content and add it to your browser bookmarks.
javascript:document.write('
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body {
margin: 20px;
font-family: sans-serif;
@Martin-Andersen
Martin-Andersen / DataGridTextColumn
Created September 11, 2014 07:28
This is a WPF DataGridTextColumn with some very common properties that should have been build in from the start (-: You get TextTrimming, HorizontalAlignment and ToolTip
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace FirstFloor.ModernUI.Windows.Controls
{
/// <summary>
/// A DataGrid text column using default Modern UI element styles.
/// </summary>
public class DataGridTextColumn : System.Windows.Controls.DataGridTextColumn
{
@Martin-Andersen
Martin-Andersen / ExtendConfiguration
Created December 16, 2013 17:06
If you want to use NHibernate lazy load and also want to implements INotifyPropertyChanged on your entities the you need this code. The code is taken from this article http://weblogs.asp.net/ricardoperes/archive/2012/06/19/implementing-an-interceptor-using-nhibernate-s-built-in-dynamic-proxy-generator.aspx
FluentConfiguration cfg = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008.IsolationLevel(IsolationLevel.ReadCommitted).ConnectionString(connectionString)
/*.ShowSql()*/)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SagMap>()
//.ExportTo("c:\\temp")
.Conventions.Add(typeof (NHibernateConvention))
.Conventions.Add(DefaultLazy.Always()))
.Cache(c => c.ProviderClass<SysCacheProvider>().UseSecondLevelCache())
.ExposeConfiguration(ExtendConfiguration);
@Martin-Andersen
Martin-Andersen / OpenDocumentViewModel.cs
Last active December 14, 2015 11:39
I am trying to "translate" code for article "ReactiveXaml series: Implementing search with ObservableAsPropertyHelper" to newest RxUI version I am having trouble with this line : _photos = new ObservableAsPropertyHelper<List<FlickrPhoto>>(results, _ => this.RaisePropertyChanged(x=>x.Photos),false); Result is not the correct type;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reactive.Linq;
using System.Web;
using System.Windows;
using System.Xml.Linq;
using ReactiveUI;
using ReactiveUI.Xaml;