Skip to content

Instantly share code, notes, and snippets.

View mastoj's full-sized avatar

Tomas Jansson mastoj

View GitHub Profile
@mastoj
mastoj / sample_tests.sml
Created January 28, 2013 09:13
sml test setup
val remove_card_tests = start_string
val should_thrown_exception_if_not_in_list =
assert_raise ((fn y => remove_card ([(Spades, Jack), (Hearts, Num 5)], (Diamonds, Num 4), CardNotFound)), CardNotFound)
val removes_first_entry_if_in_list =
assert_equal([(Diamonds, Num 8), (Spades, Jack), (Hearts, Ace)],
remove_card ([(Hearts, Ace), (Diamonds, Num 8), (Spades, Jack), (Hearts, Ace)], (Hearts, Ace), CardNotFound),
card_list_formatter)
private string _connectionStringKey = "MyCloudStorage";
private string _containerName = "mycontainer"; // important with lower case letters
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
var files = GetFiles();
return View(model: files);
}
@mastoj
mastoj / extreme_startup.js
Created February 28, 2013 21:15
Coding dojo. The most interesting parts are from row 123 to 149.
var express = require("express");
/* Reimplement this function to answer questions. */
var myName = function(matches) {
return "Tomas";
};
var yourName = function(matches) {
return matches[1];
@mastoj
mastoj / app.js
Last active December 19, 2015 09:38
Issue 2031 of emberjs
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({
model: function(){
return App.IndexModel.create();
}
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CQRSDemo
{
@mastoj
mastoj / gist:6375018
Created August 29, 2013 07:09
nslookup resharper-plugins.jetbrains.com
Non-authoritative answer:
Name: waws-prod-db3-003.cloudapp.net
Address: 137.135.129.175
Aliases: resharper-plugins.jetbrains.com
resharper-plugins.azurewebsites.net
waws-prod-db3-003.vip.azurewebsites.windows.net
namespace Configurer
{
public static class SomeThing
{
public static string SomeString { get; set; }
}
public class PreApplicationStartCode
{
public static void Start()
@mastoj
mastoj / HelloOwin.cs
Last active April 30, 2018 15:38
Simple self hosted Hello World app using Owin.
namespace HelloOwin
{
using System;
using Microsoft.Owin.Hosting;
using Owin;
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>;
class Program
{
static void Main(string[] args)
@mastoj
mastoj / Program.cs
Created November 12, 2013 15:48
Simple Nowin app with middleware
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
using Nowin;
namespace HelloNowin
{
using AppFunc = Func<IDictionary<string, object>, Task>;
@mastoj
mastoj / OctoDeployScript.ps1
Created December 2, 2013 09:00
Script for automating deployment using the v 2.0 api of Octopusdeploy
Param([string]$ServerUrl,
[string]$ProjectName,
[string]$EnvironmentName,
[string]$Version,
[string]$RootUrl,
[string]$OctoApiKey)
Write-Host "Server url: $ServerUrl"
Write-Host "Project name: $ProjectName"
Write-Host "Environment name: $EnvironmentName"