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
declare | |
@templateSchemaName nvarchar(max) | |
, @templateTableName nvarchar(max) | |
, @newSchemaName nvarchar(max) | |
, @newTableName nvarchar(max) | |
with columninfo as ( | |
select | |
t.name table_name | |
, c.name column_name |
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 MyTypeProviders | |
open System | |
open System.IO | |
open System.Reflection | |
open ProviderImplementation.ProvidedTypes | |
open Microsoft.FSharp.Core.CompilerServices | |
open CsvHelper | |
open System.Collections.Generic | |
open Microsoft.FSharp.Quotations |
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
// code converted for http://seif.codes/playing-with-net-dotnet-and-ironfunctions/ | |
// https://twitter.com/SeifLotfy/status/805901527659540480 | |
open System | |
open System.IO | |
open System.Security.Cryptography | |
open System.Text | |
let downloadRemoteImageFile (url: string) = | |
let request = url |> System.Net.WebRequest.CreateHttp |
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 Microsoft.FSharp.Reflection | |
module SimpleUnionCaseInfoReflection = | |
// will crash if 'T contains members which aren't only tags | |
let Construct<'T> (caseInfo: UnionCaseInfo) = FSharpValue.MakeUnion(caseInfo, [||]) :?> 'T | |
let GetUnionCaseInfoAndInstance<'T> (caseInfo: UnionCaseInfo) = (caseInfo, Construct<'T> caseInfo) | |
let AllCases<'T> = |
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
create procedure dbo.dynamic_simple_contingency_table_query | |
@withExpression nvarchar(max) -- ^ optional with CTE expression | |
, @selectStatement nvarchar(max) -- ^ select statement, should return at least three columns, whose name matches following parameters | |
, @row_column_key nvarchar(max) -- ^ column name which identifies row keys (result will have as many distinct rows as found here) | |
, @column_column_key nvarchar(max) -- ^ column name which identifies column keys (result will have as many distinct values as found here) | |
, @fact_column_key nvarchar(max) -- ^ column name which contains facts | |
as | |
begin | |
declare @sql nvarchar(max) | |
set @sql = @withExpression |
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.Data.SqlClient | |
type EntryType = | |
| BuffersReceived | |
| BuffersSent | |
| BytesSent | |
| ConnectionTime | |
| CursorOpens | |
| IduCount |
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
// replicating same techniques as | |
// https://youtu.be/1ZJ8ROVS5gk?t=1435 | |
[<Struct>] | |
type Point = | |
val mutable X : int | |
val mutable Y : int | |
new(x, y) = { X = x; Y = y } | |
type Enemy(location: Point) = |
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
with | |
unique_constraint_infos (schemaname, tablename, constraintname, columnname) | |
as ( | |
select | |
quotename(tc.table_schema) | |
, quotename(tc.table_name) | |
, quotename(tc.constraint_name) | |
, quotename(cc.column_name) | |
from | |
information_schema.table_constraints tc |
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
// Dev Express documentation is lacking F# interactive samples | |
// https://docs.devexpress.com/WindowsForms/2508/controls-and-libraries/chart-control/examples/producing-output/how-to-export-a-chart-to-image | |
#r @"paket: nuget DevExpress.XtraCharts.v21.1" | |
open System.IO | |
open System.Windows.Forms | |
open DevExpress.XtraCharts | |
let pieChart = ChartControl(Width=1600,Height=1000) | |
let series = | |
new Series( |
OlderNewer