Skip to content

Instantly share code, notes, and snippets.

View codewithpassion's full-sized avatar

Dominik Fretz codewithpassion

View GitHub Profile
@codewithpassion
codewithpassion / buildserver-prayer
Created May 8, 2012 04:54
the build server prayer
the build server prayer (loosely based on The Lord's Prayer), by @chrisrbooth:
Our build, who art on the build server,
Hallowed be thy name,
Thy tasks be done,
Thy tests be run,
On the build server,
As it they are on my dev pc
Give us this day, no weird exceptions
Forgive us our breaking check-ins
@codewithpassion
codewithpassion / gist:2880981
Created June 6, 2012 09:44
#MEF ImportMany on interfaces
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var cat = new AssemblyCatalog(typeof(Program).Assembly);
var container = new CompositionContainer(cat);
var someObject = container.GetExportedValue<SomeClass>();
@codewithpassion
codewithpassion / Domain.cs
Created November 15, 2012 07:56
A better clonable
public class Book : ICloneable
{
public string Title { get; set; }
public String Description { get; set; }
object ICloneable.Clone()
{
return new Book { Title = Title , Description = Description };
}
}
@codewithpassion
codewithpassion / gist:4131188
Created November 22, 2012 13:30
EventBrokerSubscriptionStrategy
public class EventBrokerSubscriptionStrategy : ActivationStrategy
{
public override void Activate(IContext context, InstanceReference reference)
{
reference.IfInstanceIs<IHandle>(messageHandler => Subscribe(messageHandler, context));
}
private static void Subscribe(IHandle messageHandler, IContext context)
{
IEventBrokerSubscriber eventBroker = context.Kernel.Get<IEventBrokerSubscriber>();
@codewithpassion
codewithpassion / gist:4365823
Last active December 10, 2015 02:09
Example of using Ninject Factory Etxtension together with Convention based binding. Based on a question by @JefClaes See as well https://gist.github.com/4363612
using Ninject;
using Ninject.Extensions.Factory;
public interface ICommand
{
void Execute();
}
public interface INameProvider
@codewithpassion
codewithpassion / InterfaceBasedDevelopmentWithTest.cs
Created February 21, 2013 08:43
Create interfaces for your clases. Depend on the interfaces. Make it testable.
public class Author
{
public string Name { get; set; }
}
public class Book
{
public string Title { get; set; }
}
@codewithpassion
codewithpassion / gist:6173849
Created August 7, 2013 13:03
The script, or rather step by step approach, to take a beaglebone ubuntu demo image and make it into an OpenROV image. The lines prefixed with ## are not shell commands but rather stuff that needs to be done
tar xf ../../ubuntu-saucy-console-armhf-2013-07-22.tar.xz
cd ubuntu-saucy-console-armhf-2013-07-22/
mkdir root
cd root
tar xf ../armhf-rootfs-ubuntu-saucy.tar
mount --bind /dev/ dev/
mount --bind /proc/ proc/
mount --bind /sys/ sys/
mount --bind /run/ run/
mount --bind /etc/resolv.conf etc/resolv.conf
@codewithpassion
codewithpassion / vagrang log
Created October 7, 2014 01:06
Vagrant log
================================================================================
Error executing action `run` on resource 'bash[migrate database]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20141007-1189-7ksn3t-0" ----
STDOUT: <style type="text/css">
#kohana_error { background: #ddd; font-size: 1em; font-family:sans-serif; text-align: left; color: #111; }
@codewithpassion
codewithpassion / PluginFinderConfig.js
Created April 20, 2015 05:48
PluginFinderConfig.js with namespace
(function() {
'use strict';
window.Cockpit.SystemPlugins = window.Cockpit.SystemPlugins || { PluginFinder: {} }
window.Cockpit.SystemPlugins.PluginFinder.PluginFinderConfig = function PluginFinderConfig() {
var self = this;
self.get = function (pluginName, callback) {
$.get('/system-plugin/plugin-finder/config/' + pluginName, function (config) {
if (callback !== undefined)
callback(config);
});

Keybase proof

I hereby claim:

  • I am codewithpassion on github.
  • I am codewithpassion (https://keybase.io/codewithpassion) on keybase.
  • I have a public key whose fingerprint is B7AC 972F 6435 F9FF 6F7A AD59 7067 48F6 AF49 5AF9

To claim this, I am signing this object: