Skip to content

Instantly share code, notes, and snippets.

@cloudRoutine
cloudRoutine / UnicodeMath.sublime-settings
Last active August 29, 2015 14:03
Custom symbol definitions for SublimeText plugin "UnicodeMath"
{
// Custom symbols
// Use it for your symbols, for example:
// {
// "mysymbol": "\u0021",
// "myothersymbol": "\u2080"
// }
// If symbols aren't displaying properly consider using a different font
// "DejaVu Sans Mono" has encodings for all glyphs in this file
@cloudRoutine
cloudRoutine / English-Integer.fs
Last active August 29, 2015 14:03
Function that takes a bigint as input and outputs its word form
let english_integer ( i : bigint ) : string =
let ZERO_TO_19 =
[ "zero" ; "one" ; "two" ; "three" ; "four" ; "five" ;
"six" ; "seven" ; "eight" ; "nine" ; "ten" ; "eleven" ;
"twelve" ; "thirteen" ; "fourteen" ; "fifteen" ; "sixteen" ; "seventeen" ;
"eighteen" ; "nineteen" ]
let HYPHEN_ONES =
[ "" ; "-one" ; "-two" ; "-three" ; "-four" ; "-five" ;
(*
Example Tree Print
------------------
______________[64]______________
/ \
____[73]_____ _____[88]
/ \ / \
[0] [13] [32]
/ \ / \ / \
@cloudRoutine
cloudRoutine / Ancestor-Tree.fs
Last active August 29, 2015 14:03
Prints Binary Trees In "Ancestor" Orientation ( AKA Leaves on the Top )
(*
Example Tree Print
------------------
[Grandfather] [Grandmother] [Grandpa] [Grandma]
|______________| |__________|
| |
[Dad] [Mom]
|_______________________|
|
@cloudRoutine
cloudRoutine / PipeTree.fs
Last active August 29, 2015 14:03
Prints Binary Trees in horizontal orientation connected by pipes
(*
Prints Trees Like
-----------------
[Node]
|
|_(1)_[Leaf]
|
|_(1)_[Node]
|
@cloudRoutine
cloudRoutine / xaml_reference.fs
Last active August 29, 2015 14:05
F# Xaml GUI Quick Reference
/// Xaml Reference
module MainApp =
// Imports
open System
open System.Diagnostics
open System.Windows
open System.Windows.Controls
@cloudRoutine
cloudRoutine / booyer-moore_knuth-morris-pratt.fs
Last active April 23, 2021 19:55
String Search Algorithms ( Boyer-Moore & Knuth-Morris-Pratt )
module StringMatching =
open System
/// Knuth-Morris-Pratt String Searching Algorithm ///
let kmp_search (text:string) (word:string) : int =
let kmp_table (word:string) =
let table = [| 1..word.Length |]
table.[0] <- -1
@cloudRoutine
cloudRoutine / RoughMetrics.fsx
Last active July 20, 2016 12:10
Since Visual Studio won't calculate code metrics for F# projects, this script will calculate some some rough stats.
open System
open System.IO
let find_files dir = Directory.GetFiles( dir, "*.fs?", SearchOption.AllDirectories )
let not_start (s:string) p = not <| s.StartsWith p
let has_type (s:string) = if s.Contains @"type" then 1 else 0
let has_module (s:string) = if s.Contains @"module" then 1 else 0
let has_binding (s:string) = if s.Contains @"let" ||
s.Contains @"member" then 1 else 0
namespace Scratch
open System
open System.Windows
open FsXaml
module ScratchModel =
type CustomQueryView = XAML<"CustomQuery.xaml">
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Scratch;assembly=App"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="WindowRoot" mc:Ignorable="d"
Title="Tagger" Height="518.283" Width="320.582" AllowsTransparency="True" WindowStyle="None" MinWidth="100" MinHeight="100" BorderBrush="#FF6C6C6C" Background="{x:Null}" UseLayoutRounding="True" ResizeMode="CanResizeWithGrip" IsTabStop="False" IsManipulationEnabled="True">
<Window.Resources>
<Color x:Key="ScrollBar">#FF404040</Color>