Skip to content

Instantly share code, notes, and snippets.

View schuster-rainer's full-sized avatar

Rainer Schuster schuster-rainer

View GitHub Profile
@schuster-rainer
schuster-rainer / RelayCommand.cs
Created May 9, 2012 21:17
Implementation from Josh Smith of the RelayCommand
//http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090030
public class RelayCommand : ICommand
{
#region Fields
readonly Action<object> _execute;
readonly Predicate<object> _canExecute;
#endregion // Fields
@schuster-rainer
schuster-rainer / wpf.clj
Created July 6, 2012 19:11
Run a WPF Window from ClojureCLR and modify it at the REPL
;reference wpf assemblys
(import '(System.Reflection Assembly))
(Assembly/LoadWithPartialName "PresentationFramework")
(Assembly/LoadWithPartialName "PresentationCore")
(Assembly/LoadWithPartialName "WindowsBase")
(ns wpf
(:import (System.Windows Application Window))
(:import (System.Windows.Threading Dispatcher DispatcherPriority))
(:import (System.Threading ApartmentState ThreadStart Thread AutoResetEvent))
@schuster-rainer
schuster-rainer / qmlview.py
Created February 10, 2012 09:33
QML viewer using PySide to display a qml or html embedding a qml
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PySide import QtCore, QtGui, QtDeclarative
import argparse
from PySide.QtWebKit import QWebPluginFactory, QWebView, QWebSettings
@schuster-rainer
schuster-rainer / DynamicBindingProxy.cs
Created May 9, 2012 14:09
INotifyPropertyChanged generic proxy implementation based on DynamcObject and the DLR
// http://www.deanchalk.me.uk/post/WPF-e28093-Easy-INotifyPropertyChanged-Via-DynamicObject-Proxy.aspx
public class DynamicBindingProxy<T> : DynamicObject, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private static readonly Dictionary<string, Dictionary<string, PropertyInfo>> properties =
new Dictionary<string, Dictionary<string, PropertyInfo>>();
private readonly T instance;
private readonly string typeName;
@schuster-rainer
schuster-rainer / docker-dns
Created October 9, 2018 07:44
dns for resolving docker hostnames
#!/bin/bash
# https://stackoverflow.com/questions/37242217/access-docker-container-from-host-using-containers-name
docker run --hostname dns.mageddo --name dns-proxy-server -p 5380:5380 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/resolv.conf:/etc/resolv.conf \
defreitas/dns-proxy-server
@schuster-rainer
schuster-rainer / Dockerfile
Created September 13, 2018 14:39
CentOS based rails docker setup
FROM drecom/centos-ruby:2.2.3
MAINTAINER Rainer Schuster <schuster-rainer@web.de>
ENV TZ Europe/Berlin
ENV LANG en_US.UTF-8
ENV APP_USER myapp
ENV APP_GROUP web
ENV HOME_DIR /home/${APP_USER}
@schuster-rainer
schuster-rainer / minimal_vst2x_host.cpp
Created July 25, 2018 12:08 — forked from t-mat/minimal_vst2x_host.cpp
WIN32 : Minimal VST 2.x host in C++11.
// Win32 : Minimal VST 2.x Synth host in C++11.
//
// This is a simplified version of the following project by hotwatermorning :
// A sample VST Host Application for C++ Advent Calendar 2013 5th day.
// https://github.com/hotwatermorning/VstHostDemo
//
// Usage :
// 1. Compile & Run this program.
// 2. Select your VST Synth DLL.
// 3. Press QWERTY, ZXCV, etc.
@schuster-rainer
schuster-rainer / libgit2.ipynb
Created February 13, 2018 08:45
using git as database from python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@schuster-rainer
schuster-rainer / MyWPFUI.xaml
Created July 12, 2012 22:16
Clojure.Compile a ClojureCLR script with gen-class and a WPF UI into an executable console app
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My WPF UI" Height="300" Width="300">
<StackPanel Margin="5">
<StackPanel>
<Label Content="Prename:" />
<TextBox x:Name="preName" MinWidth="50"/>
</StackPanel>
<StackPanel>
<Label Content="Surename:" />
@schuster-rainer
schuster-rainer / example.js
Created August 23, 2017 16:27
redux-form-immutable validator with JSON API
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Field, reduxForm } from 'redux-form/immutable';
import muiThemeable from 'material-ui/styles/muiThemeable';
import './form';
import validatejs from 'validate.js';
const ExampleForm = ({onSubmit, ...props}) => (
<form onSubmit={onSubmit}>