Skip to content

Instantly share code, notes, and snippets.

@alfonsogarciacaro
alfonsogarciacaro / ConsoleTracer.fs
Last active May 12, 2022 12:43
A cleaner console tracer for Elmish apps
module ConsoleTracer
open System
open Fable.Core
// Use it when initializing your Elmish app like this
//|> Program.withTrace ConsoleTracer.withTrace
let getMsgNameAndFields (t: Type) (x: 'Msg): string * obj =
let rec getCaseName (t: Type) (acc: string list) (x: obj) =
@matthid
matthid / ReactErrorBoundary.fs
Created September 20, 2018 17:41
React error boundary for rendering issues with fable, designed to be used with elmish architecture
module ReactErrorBoundary
open Fable.Core
open Fable.Import
open Fable.Helpers.React
type [<AllowNullLiteral>] InfoComponentObject =
abstract componentStack: string with get
[<Pojo>]
@zaydek-old
zaydek-old / bookmark.min.js
Last active January 22, 2023 13:42
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@nojaf
nojaf / QuerySelector.fs
Created September 26, 2017 08:37
Fable querySelector
module Helper
open Fable.Import.Browser
let private toList (nodeList:NodeListOf<Element>) =
let length = nodeList.length - 1.0
[0.0 .. length]
|> List.map (fun i -> nodeList.item i :?> HTMLElement)
let dollar selector (element:HTMLElement) =
@JonDouglas
JonDouglas / xamarinandroidbindings.md
Last active March 12, 2024 10:36
Xamarin Android Bindings Troubleshooting

Approaching a Xamarin.Android Bindings Case

1. Investigation

One of the best ways to investigate a problematic Xamarin.Android Binding is to first ensure you have the proper tooling available:

@latkin
latkin / README.md
Last active February 9, 2016 05:50
Blog: sequence benchmarking
@paulodeleo
paulodeleo / .tmux.conf
Last active July 15, 2022 10:16
Tmux configuration to enable mouse scroll and mouse panel select, taken from: http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
@miebach
miebach / rotate-a-wb-page-javascript.rst
Last active November 14, 2023 18:28
Rotate a web page 90 degree counter clockwise:

Rotate a web page 90 degree counter clockwise

Chrome

javascript: document.body.setAttribute( "style", "-webkit-transform: rotate(-90deg);");

paste into JS console: Ctrl-Shift-C -> "Console" from top menu

@next2you
next2you / Postgres Index Usage.sql
Created October 15, 2010 20:12 — forked from sriedel/Postgres Index Usage
Postgres: Determine table/index size
SELECT idx.relname as table,
idx.indexrelname as index,
pg_relation_size( idx.indexrelname::text )/1024/1024 as bytes,
cls.relpages as pages,
cls.reltuples as tuples,
idx.idx_scan as scanned,
idx.idx_tup_read as read,
idx.idx_tup_fetch as fetched
FROM pg_stat_user_indexes idx,
pg_class cls ,