Skip to content

Instantly share code, notes, and snippets.

View makomweb's full-sized avatar
🌀

Martin Komischke makomweb

🌀
View GitHub Profile
@makomweb
makomweb / ViewModelBase.cs
Created November 23, 2015 10:28
Updated ViewModelBase
namespace Sandbox
{
public class ExampleViewModel : ViewModelBase
{
public string Title
{
get { return GetValue(() => Title); }
set { SetValue(() => Title, value); }
}
}
public class LoginExplorations
{
public async Task<DataContracts.List[]> FetchListsAsync(string accessToken, string deviceId)
{
var info = new TestSystemInfo(
userAgent: "Wunderlist.Sdk/" + new AssemblyInfoHelper(typeof (RestClient)).AssemblyVersion,
clientId: "01d4f9dcdafd531da497",
clientProductGitHash: new AssemblyInfoHelper(typeof (RestClient)).InformationalVersion,
clientDeviceId: deviceId,
clientSystem: "Windows RT device",
@makomweb
makomweb / observable_null_vs_empty.cs
Created April 8, 2016 17:00
Observable null vs. empty
public class MyTests
{
public class Package { }
public class Service
{
public IObservable<Package> DeliverRegular()
{
return DeliverRegularAsync().ToObservable();
}
@makomweb
makomweb / awaiting_null_should_throw.cs
Created July 14, 2017 08:31
When awaiting null it should throw
[Fact]
public async Task When_awaiting_null_it_should_throw()
{
try
{
Task t1 = Task.Run(() => { /* do nothing */ });
Task t2 = null;
await Task.WhenAll(t1, t2);
Assert.True(false, "Should have thrown before!");
}
@makomweb
makomweb / batch_resize.py
Created September 19, 2018 09:28
Python script for batch resizing images and keeping the aspect ratio
from PIL import Image
import os, sys
path = "c:\\Workspace\Images"
dirs = os.listdir( path )
mywidth = 640
def resize_keep_aspect_ration():
for item in dirs:
img_path = path + "\\" + item
@makomweb
makomweb / hello-rx.js
Created August 20, 2019 14:28
simple script to run node js app with reactive extensions
const Rx = require('rx');
const sequence = Rx.Observable.create(function(src) {
src.onNext(1);
src.onNext(2);
src.onNext(3);
src.onNext(4);
src.onError(new Error("booom!!!"));
src.onNext(5);
src.onCompleted();
@makomweb
makomweb / learnings-oauth2-oidc.md
Created January 3, 2020 13:55
My learnings about OAuth2.0 and Open ID Connect

OAuth 2.0

Endpoints

Endpoint Example Purpose
Authorization https://<auth-server>/oauth/authorize used by the client application to obtain authorization grant from the resource owner via user-agent redirection
Token https://<auth-server>/oauth/token used by the client application to exchange an authorization grant for an access token, typically with client authentication
Redirection https://<client>/callback used by the authorization server to return responses containing authorization grants to the client via the resource owner user-agent
@makomweb
makomweb / notes-technology-lunch-innoq.md
Last active November 5, 2020 09:26
Meine Notizen vom Technology Lunch "Softwarearchitektur für Entscheider" (gehalten von Stefan Tilkov)

Mitschrift: Technology Lunch - INNOQ - Softwarearchitektur für Entscheider

Youtube: Software-Architektur für Entscheider – INNOQ Technology Lunch

Was ist Software-Architektur? (2 Beispieldefinitionen)

Die Komponenten eines Systems, ihre Beziehungen zueinander sowie die Prinzipien und Regeln, denen ihre (Weiter-)Entwicklung folgt. (ISO 42010)

Die Summe der bedeutenden Design-Entscheidungen, die das System formen, wobei >>bedeutend<< anhand der Änderungskosten gemessen wird. (Grady Booch)

@makomweb
makomweb / fix-author-committer.sh
Created January 19, 2021 15:02
Change committer and author of all commits in a repo
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='__AUTHOR_NAME__'
GIT_AUTHOR_EMAIL='__AUTHOR_EMAIL_ADDRESS__'
GIT_COMMITTER_NAME='__COMMITTER_NAME__'
GIT_COMMITTER_EMAIL='__COMMITTER_EMAIL_ADDRESS__'
" HEAD
@makomweb
makomweb / cleanup.sh
Created March 23, 2021 13:31
Cleanup files which should be ignored in VCS
# update .gitignore properly
# after that:
git rm -rf --cached .
git add .