Skip to content

Instantly share code, notes, and snippets.

@crowcoder
crowcoder / Invoice
Created September 4, 2014 23:39
CSS/HTML only report sample implemented as a simple Invoice
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Invoice</title>
<style media="screen">
body {
font-family: 'Segoe UI','Microsoft Sans Serif',sans-serif;
}
/*
#####################
## EXERCISE 2
#####################
# Authenticate to Azure
Connect-AzAccount
# List the subscriptions your account has access to
Get-AzSubscription
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace CosmosCreateSproc
{
class Program
{
static async Task Main(string[] args)
{
@crowcoder
crowcoder / CSharpBasicAlternateDataStream
Last active August 13, 2019 12:05
A bare-bones example of how to write alternate data streams with C#
using Microsoft.Win32.SafeHandles;
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace AlternateDataStreams
{
class Program
{
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
@crowcoder
crowcoder / BasicGameIntegration
Last active January 26, 2019 15:56
BasicGameIntegration
<!doctype html>
<html>
<head>
<!-- stuff... -->
</head>
<body>
<div id="gameDiv"></div>
<script src="https://newupwaititsfun.z13.web.core.windows.net/frog/game.js" integrity="sha384-qoRzVFhcu3MPqU4+hUIAG45mJWAXYwf1QDlkHQY2519KjBjFyETk7mTDV/wY9AD1"
crossorigin="anonymous"></script>
</body>
[TestMethod]
public void BuyWhenLastTradeWasSell_Test()
{
#region setup the stock service
decimal simulatedCurrentPrice = 8.03m;
Trade simulatedLastTrade = new Trade
{
Ticker = "ABC",
Side = "sell",
using Service;
using System;
namespace Business
{
public class StocksLogic
{
private readonly IStockService _stockService;
private readonly ILogService _logService;
namespace Service
{
public interface ILogService
{
void Log(string logMessage);
}
}
namespace Service
{
public interface IStockService
{
Trade Buy(string ticker, decimal nbrShares);
decimal GetCurrentPrice(string ticker);
Trade GetLastTrade(string ticker);
Trade Sell(string ticker, decimal nbrShares);
}
}