Skip to content

Instantly share code, notes, and snippets.

View richorama's full-sized avatar
💭
:octocat: 👾 🔥 ☁️

Richard Astbury richorama

💭
:octocat: 👾 🔥 ☁️
View GitHub Profile
all: clean lint test build
clean:
rm -f *.min.js
lint: clean
jshint --config jshintconfig.json $(filter-out $(wildcard *.min.js), $(wildcard *.js))
test:
mocha
@richorama
richorama / wpf.js
Last active January 4, 2018 17:54
Display a WPF Window from node.js using edge.js
var edge = require('edge');
var hello = edge.func(function () {/*
#r "PresentationCore.dll"
#r "PresentationFramework.dll"
#r "WindowsBase.dll"
#r "System.Xaml.dll"
#r "System.Threading.dll"
@richorama
richorama / app.js
Last active August 29, 2015 14:06
Display WinForm from edge.js
var edge = require('edge');
var hello = edge.func(function () {/*
#r "System.Windows.Forms.dll"
using System.Windows.Forms;
using System.Threading.Tasks;
using System;
public class Startup
{
@richorama
richorama / Azure Search service.md
Last active August 29, 2015 14:05
Using the Azure Search service from JavaScript

surface-your-data

The new Azure Search service is a nice 'search as a service' offering from Microsoft. Just add your documents, and then run some queries. It's exposed as a REST API which talks JSON :¬D

It has a free tier, limited to 3 indexes and 10,000 documents, but you can of course start paying the money and index more stuff.

I just wrote a JavaScript client (I couldn't find a Microsoft one) to connect to the API, let's explore how we can use it.

Note this article assumes you are familiar with writing JavaScript for node.js and the browser.

@richorama
richorama / gist:efc31af9fcb066f399a6
Created July 28, 2014 11:02
Send a Yo! from Windows Phone 8.1
static async Task<bool> Yo()
{
using (var client = new HttpClient())
using (var mfdc = new MultipartFormDataContent())
{
mfdc.Add(new StringContent("YOUR_API_TOKEN"), name: "api_token");
var response = await client.PostAsync("http://api.justyo.co/yoall/", mfdc);
return response.IsSuccessStatusCode;
}
}
@richorama
richorama / GrainTests.cs
Last active August 29, 2015 14:04
A unit testing class for Orleans Silos
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Orleans.Host.SiloHost;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace Tests
{
[TestClass]
public class GrainTests
@richorama
richorama / main.cs
Last active August 29, 2015 14:03
FuncGenerator
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
@richorama
richorama / index.js
Created June 30, 2014 21:25
Playing wav files in Node.js using Edge.js
var edge = require('edge');
var play = edge.func(function () {/*
async (input) => {
(new System.Media.SoundPlayer(input as string)).Play();
return input;
}
*/});
play("pacman_beginning.wav", function (error, result) {
@richorama
richorama / makefile
Last active August 29, 2015 14:02
My makefile for browserify and uglify
all: clean lint test build
clean:
rm -f *.min.js
lint: clean
jshint --config jshintconfig.json $(filter-out $(wildcard *.min.js), $(wildcard *.js))
test:
mocha
@richorama
richorama / server.js
Last active August 29, 2015 14:02
Experimental generic http interface for Codename Orleans
/*
Experimental generic http interface for Codename Orleans
To use, POST to this url:
POST /grainType/grainId/grainMethod
[arg1, arg2]
grain response will be in the http response body