Skip to content

Instantly share code, notes, and snippets.

View marcingolenia's full-sized avatar
🎯
Focusing

marcingolenia

🎯
Focusing
View GitHub Profile
@fabioam
fabioam / runapp.sh
Last active September 13, 2022 21:37
Run cool-retro-term as Guake
# This script searchs for the application with the
# given classname. There are three possibilities:
# 1. If the app is not open, opens it
# 2. If the app is open but is not the active window, activates it
# 3. If the app is open AND is the active window, minimizes it#
# The idea is to assign this script to keyboard shortcuts in order
# to launch/activate/minimize a common used application quickly
#
# Requieres 'xdotool' installed
@mjul
mjul / elasticsearch.fsx
Last active June 1, 2022 08:15
Elasticsearch in F# example
// paket add nuget NEST
#I "../../packages"
#r "Elasticsearch.Net/lib/net46/Elasticsearch.Net.dll"
#r "NEST/lib/net46/Nest.dll"
open System
//open Elasticsearch.Net
open Nest
@jbtule
jbtule / NullCoalesce.fs
Last active May 13, 2022 16:38
Null Coalesce Operator for F# (|??), works with option, Nullable, and c# reference types
//inspired by http://stackoverflow.com/a/2812306/637783
type NullCoalesce =
static member Coalesce(a: 'a option, b: 'a Lazy) = match a with Some a -> a | _ -> b.Value
static member Coalesce(a: 'a Nullable, b: 'a Lazy) = if a.HasValue then a.Value else b.Value
static member Coalesce(a: 'a when 'a:null, b: 'a Lazy) = match a with null -> b.Value | _ -> a
let inline nullCoalesceHelper< ^t, ^a, ^b, ^c when (^t or ^a) : (static member Coalesce : ^a * ^b -> ^c)> a b =
((^t or ^a) : (static member Coalesce : ^a * ^b -> ^c) (a, b))