Skip to content

Instantly share code, notes, and snippets.

View rkusa's full-sized avatar
💭
Busy with non-Github stuff. Very slow to respond.

Markus Ast rkusa

💭
Busy with non-Github stuff. Very slow to respond.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rkusa on github.
  • I am rkusa (https://keybase.io/rkusa) on keybase.
  • I have a public key whose fingerprint is CBC2 3F65 3DB7 B0CB 7298 BF32 01FE FDC2 E399 E2B7

To claim this, I am signing this object:

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@rkusa
rkusa / README.md
Last active August 29, 2015 14:04
Custom Zwoptex 2 coordinates JSON template.
@rkusa
rkusa / couchdb-import.rb
Last active August 29, 2015 14:17
populate test database with github archive data
require 'open-uri'
require 'zlib'
require 'yajl'
require 'net/http'
require 'json'
Net::HTTP.start('localhost', 5984, read_timeout: 3600) do |http|
24.times do |d|
24.times do |h|
var statusChangedToReady = from sc in statusChanged
where sc.Status == GeoPositionStatus.Ready
select sc;
var positionChanged = from _ in statusChangedToReady
from pc in watcher.GetPositionChangedEventObservable()
where !pc.EventArgs.Position.Location.IsUnknown
select pc.EventArgs.Position;
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
public static class GeoPositionWatcherExtensions
{
public static IObservable<IEvent<GeoPositionStatusChangedEventArgs>> GetStatusChangedEventObservable<T>(this IGeoPositionWatcher<T> watcher)
{
return Observable.FromEvent<GeoPositionStatusChangedEventArgs>(ev => watcher.StatusChanged += ev, ev => watcher.StatusChanged -= ev);
}
public static IObservable<IEvent<GeoPositionChangedEventArgs<T>>> GetPositionChangedEventObservable<T>(this IGeoPositionWatcher<T> watcher)
{
return Observable.FromEvent<GeoPositionChangedEventArgs<T>>(ev => watcher.PositionChanged += ev, ev => watcher.PositionChanged -= ev);
var statusChanged = from sc in watcher.GetStatusChangedEventObservable()
select sc.EventArgs;
statusChanged.Subscribe(item => Deployment.Current.Dispatcher.BeginInvoke(() => {
// update your status textblock
TextBlock.Text = Enum.GetName(typeof(GeoPositionStatus), item.Status);
if (item.Status == GeoPositionStatus.Ready)
{
// f.e. hide your loading bar
positionChanged.Skip(1).Zip(positionChanged, (lhs, rhs) => new
{
Position1 = rhs,
Position2 = lhs,
Distance = lhs.Location.GetDistanceTo(rhs.Location)
}).Subscribe(item => Deployment.Current.Dispatcher.BeginInvoke(() =>
{
// handle position ... f.e. add to a map's location collection
}));
protected void Application_Start()
{
IKernel kernel = new StandardKernel(new YourNinjectModule());
DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
// register global filters, routes, ...
}