Skip to content

Instantly share code, notes, and snippets.

View isaksky's full-sized avatar

Isak Sky isaksky

View GitHub Profile
@isaksky
isaksky / Foo.ex
Created May 23, 2019 15:00
Update URL via Liveview
# In somethingLive.ex:
def handle_event("some_event", _params, socket) do
assign(socket, :updated_url, Routes.project_path(MyApp.Endpoint, :index))
end
# In template: <%= js_url_update_script(assigns[:updated_url]) %>
# In form_helpers.ex, or similar:
Initial Commit
@isaksky
isaksky / Results.txt
Created April 25, 2018 23:24
Gjallarhorn read consistency
..................................X...X....X.X.X.X....XX.XXX...X.....XX....X..........XX.....X..X..XX..X.......X....X...XXX.X..X..XX....X.X..XX.X..X.X....X....X.X.XX.X..........XX..X....X.XX.X.XX..XXX.XXXXXX............X.....X..XX..XXX.....X.X.X.X....X..X.XX.XX.X..XX....X.......X..X.X...XX.XX..X..X..X..XX..X......X..XX.XX.XX..X.....X...XX..X.....XX......X.......X....X.................X.....................X...............X............X.X.......XX..XX......X.X.X...XXXX.X.XXXXXX.X.XX..X...X........X.....XX...X.XXXXXX.....XXXX.......X.X.X...XX..X.X....XXX...X....X..X.......X.X.........X.XX....X.........XX.XX.XX.X..X...X.X.X...XX....XX...........X........................X..X.X.X...XX....................X........XX.......X........X....X...............X............X..X.X.XXX...XXXX.....XX...X...X.....X......XX.X.X...X....X..X.X..X..X..XXX.X.XXXXX........XX....XX.X.XXXXX..X.X........X...........X..X.X.X...X......XX...X......X..X.X..X.X..X.....XX...X...X.....XX..X......X..X....X.XX.X..X.X.X.X.X.X..X....X.X....XX.X...
type Base() =
member x.Method() = "base method";
type Derived() =
inherit Base()
member x.Method() = "derived method"
type Base with
member x.Extension() = "base extension"
@isaksky
isaksky / Output.txt
Created April 2, 2018 19:58
Gjallarhorn
Creating signal...
A dependency has changed. Called from thread ID 1
Setting m1...
Sleeping 200 ms
A dependency has changed. Called from thread ID 3
Signal value is now 4. thread ID: 3
Signal value is now 4. thread ID: 4
Thread awake again
Setting m2...
Finished
@isaksky
isaksky / re-frame-helper.cljs
Created January 9, 2018 03:51
reframe - Request Effect
(def req-counter (atom 0))
;; Not battle tested - adapted from an existing codebase
(rf/reg-fx
:request-giving-id
(fn [[request-id {:keys [on-complete resp-body-formatter request-args]
:or {on-complete identity
resp-body-formatter identity}
:as args}]]
@isaksky
isaksky / sq.ps1
Created May 5, 2017 02:00
Powershell Query SQL
function sq
{
param([string]$Query)
$SQLServer = "ISAK-NEW\SQLEXPRESS"
$SQLDBName = "AdventureWorks2014"
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True;"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $Query
$SqlCmd.Connection = $SqlConnection
@isaksky
isaksky / gist:ceceeb64a5d7cf666c4a18991403f97a
Last active April 19, 2017 06:05
Things I'd like to see in a .NET (F#) web framework

Some things I'd like to see in a F# web framework, inspired from experience using Phoenix in Elixir.

  • Top knotch integrated i18n support, on par with gettext in Elixir.
    • Not sure if this is possible in F#, because of the lack of metaprogramming features. The Elixir solution is based on macros, so that one can extract .pot translation files at compile time.
  • Standard way to talk to databases suitable for most apps (Elixir example: Ecto)
  • Standard way to do database migrations suitable for most apps (Elixir example: Ecto)

This is more ecosystem related, but I'll include them anyway, because I think they are important to overall productivity:

  • Standardized, extensible project build/scripting tool already on my path. Examples:
@isaksky
isaksky / Html.fs
Created January 18, 2017 20:41
Html Dsl
module Html =
type Tag(name:string) =
let mutable _safeContent = false
member val className = "" with get, set
member val content = "" with get, set
// For ease of use, support children in both list and resize array
member val childrenL : Tag list = [] with get, set
member val childrenR = ResizeArray<Tag>() with get, set
member this.name with get() = name
@isaksky
isaksky / Program.fs
Created August 23, 2016 22:32
Benchmark various ways to read N rows async
open Hopac
open BenchmarkDotNet
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
open System
open System.Data
open System.Data.SqlClient
open System.Threading.Tasks
open BenchmarkDotNet.Configs
open BenchmarkDotNet.Diagnostics.Windows