Skip to content

Instantly share code, notes, and snippets.

everything i write on medium is plausible to someone
xoxo j$
@factormystic
factormystic / MainPage.xaml.cs
Created June 20, 2014 01:05
example of akavache + dynamic
using Akavache;
using Microsoft.Phone.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
namespace akavache_dynamic_deserialization_3
{
@factormystic
factormystic / .gitconfig
Created August 31, 2015 21:49
git behind/ahead aliases
[alias]
behind = log HEAD~1..@{u} --decorate --oneline
ahead = log @{u}..HEAD --decorate --oneline
Weekend project: A little Nancy (http://nancyfx.org) extension which exposes your methods in C# as async calls in Javascript. I really like what Now.js is doing for RPC on Node and want to clone it, so this weekend's task was a fun proof of concept.
All you need to do is subclass my thing and write some public methods:<br>
http://i.imgur.com/NnqQo.png
Then in your page, include 'nanio.js' which is emitted by my lib (and JQuery, currently the sole external dependency since I'm not currently interested in rewriting ajax handling
http://i.imgur.com/TNlhX.png
And then your calls work! Yay!
http://i.imgur.com/1TuZa.png
<!DOCTYPE html>
<html>
<body>
<pre><script type="text/javascript">
try {
document.createElement("div").style.setProperty("width", 216, "");
document.write("CSSStyleDeclaration's setProperty coerces strings. Hooray!\n");
} catch (error) {
document.write("CSSStyleDeclaration's setProperty requires strings. Patching…\n");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Default
{
public static void Main(string[] args)
{
Console.WriteLine("how you like these nuts");
using System.Diagnostics;
using Microsoft.Devices.Sensors;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Reactive;
namespace Rx_Compass_Smoothing
{
public partial class MainPage : PhoneApplicationPage
{
Compass compass = new Compass();
Observable.FromEvent((EventHandler<SensorReadingEventArgs<CompassReading>> e) => new EventHandler<SensorReadingEventArgs<CompassReading>>(e),
e => compass.CurrentValueChanged += e,
e => compass.CurrentValueChanged -= e)
using System;
using System.Diagnostics;
using System.Linq;
using Microsoft.Devices.Sensors;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Reactive;
namespace Rx_Compass_Smoothing
{
public partial class MainPage : PhoneApplicationPage