This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
let dumpGif (bytes : byte[]) = | |
let i = ref 0 | |
let byte () = | |
let byte = bytes.[!i] | |
incr i | |
int byte | |
let uint16 () = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sayuri.JsonSerializer | |
open System | |
open System.Collections.Generic | |
open System.Globalization | |
open System.Text | |
[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>] | |
type JsonType = | |
| JsonNull | |
| JsonBoolean of bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
static class CsPoh { | |
static int Calculate(byte[] buffer, byte[] prices) { | |
int ii = 0, oi = 0, temp; | |
var itemCount = 0; | |
while ((temp = buffer[ii++] - '0') >= 0) | |
itemCount = itemCount * 10 + temp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<#@ template debug="false" hostspecific="true" language="C#" #> | |
<#@ assembly name="System.Core" #> | |
<#@ import namespace="System.IO" #> | |
<#@ import namespace="System.Linq" #> | |
<#@ output extension=".cs" #> | |
using System.Reflection; | |
class UnsafePoh { | |
static readonly byte[] bytes = new byte[]{ | |
<#= string.Join(Environment.NewLine, File.ReadAllBytes(Host.ResolvePath("Unsafe.dll")).Select((b, i) => new { b, i }).GroupBy(a => a.i / 16, a => string.Format("0x{0:X2}, ", a.b), (_, g) => string.Concat(g))) #> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef _MSC_VER | |
#define IO_H "io.h" | |
#define _CRT_NONSTDC_NO_WARNINGS | |
#define __attribute__(X) | |
#else | |
#define IO_H "unistd.h" | |
#define __pragma(X) | |
#define __declspec(X) | |
#define __fastcall | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sayuri | |
open System | |
open System.Net | |
open System.Security.Cryptography | |
open System.Text | |
type ParameterType = | |
| ProtocolString of string | |
| QueryString of string | |
| BodyString of string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Media; | |
namespace Sayuri.Windows { | |
public static class GridViewSort { | |
class SortIcon : Adorner { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module tinyBase64Decoder | |
open System | |
open System.Collections.Generic | |
// Declare fundamental functions | |
// Generate n length Integer List (0 upto n - 1) | |
let iota n = [0..n-1] | |
// Generate n length List of x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <future> | |
#ifdef USE_AWAIT | |
#include <experimental/resumable> | |
#include <boost/asio/use_future.hpp> | |
#else | |
#include <exception> | |
#include <memory> | |
#include <type_traits> | |
#include <utility> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Program = | |
let rec Main args = | |
let numbers : obj[] = | |
[| 0b1; 0b10; ([| 0b100; 0b1000 |] : obj[]); // binary literals | |
0b10000; 0b100000 |] // digit separators: not supported | |
let sum, count = Tally(numbers) // deconstruction | |
printfn "Sum: %d, Count: %d" sum count | |
and Tally (values : obj[]) = // tuple types | |
let mutable r = 0, 0 // tuple literals |