Skip to content

Instantly share code, notes, and snippets.

Winter is coming

Julien Roncaglia vbfox

Winter is coming
Block or report user

Report or block vbfox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
vbfox / Immutable.ts
Created Apr 16, 2019
Simple type immutable.js Map based immutable type with strongly typed keys
View Immutable.ts
import { Iterable, Map } from "immutable";
// tslint:disable:array-type
// tslint:disable:unified-signatures
export interface Immutable<T> {
set<TKey extends keyof T>(key: TKey, value: T[TKey]): Immutable<T>;
* Returns a new Map which excludes this `key`.
vbfox / FableReactEquals.fs
Last active Apr 16, 2019
Prototype of Equals function for F# Fable React interop that does the same as the (=) operator except that all functions are equal
View FableReactEquals.fs
// Flawed try, I don't think a deep function ignoring compare is practical
vbfox / TraceChanges.ts
Created Mar 27, 2019
Trace props or state that changed and made a React PureComponent refresh
View TraceChanges.ts
export class Test extends React.PureComponent<{}, {}> {
UNSAFE_componentWillUpdate(nextProps: any, nextState: any) {
const changedProps = _.reduce(
(result: string[], value, key) => value === nextProps[key] ? result : result.concat(key),
console.log("changedProps: ", changedProps);
const changedStates = _.reduce(
(result: string[], value, key) => value === nextState[key] ? result : result.concat(key),
vbfox / MemoReactHelpers.fs
Last active Oct 24, 2018
React 16.6 Fable 1
View MemoReactHelpers.fs
module MemoReactHelpers
/// A special ReactElement that tell React to not render anything
let noElement = jsNative<ReactElement>
type ComponentClass<'props, 'state> = class end
vbfox / vswhere.fs
Last active Aug 22, 2018
F# vswhere
View vswhere.fs
// Microsoft.VisualStudio.Setup.Configuration.Interop.dll
module VsInstances =
open System.Runtime.InteropServices
type private ISetupInstance =
View dynamic.fs
// dynamic x = "Foo";
// Console.WriteLine(x.ToString());
open System
open System.Runtime.CompilerServices
open Microsoft.CSharp.RuntimeBinder
let mutable toStringSite: CallSite<Func<CallSite, obj, obj>> option = None
let mutable writelineSite: CallSite<Action<CallSite, Type, obj>> option = None
vbfox /
Created Jan 28, 2018
Experimentations with using requestAnimationFrame in fable elmish

If the Elmish state should be updated by the event but not the view a wrapper component might do:

[<Import("cloneElement", from="react")>]
let cloneElement(element: ReactElement, props: obj, [<ParamList>] children: obj) = jsNative

type RequestAnimationFrameState<'a> = {
    props: 'a
vbfox / AsyncIo.fs
Created Nov 20, 2017
Fable async node IO
View AsyncIo.fs
module AsyncIO
let private readdir (dir: string): Promise<ResizeArray<string>> =
Promise.Create(fun resolve fail ->
Fs.readdir(U2.Case1 dir, fun err files ->
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 files)))
let private unlink (path: string): Promise<unit> =
Promise.Create(fun resolve fail ->
Fs.unlink(U2.Case1 path, fun err ->
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 ())))
vbfox / teamcity_agent_dedicated_non_admin_user.cmd
Last active Nov 6, 2017
TeamCity agent upgrade with dedicated user account
View teamcity_agent_dedicated_non_admin_user.cmd
REM When TC Agent is using a dedicated account that isn't admin it can update itself
REM To solve it it's enough to give the user full control of the service account
REM Install SubInAcl from
REM For service TCBuildAgent
REM And user Domain\User
"c:\Program Files (x86)\Windows Resource Kits\Tools\subinacl" /service TCBuildAgent /GRANT=Domain\User=F
vbfox / TypedTaskDefinitionHelper.fs
Last active Jan 29, 2018
Allow to define FAKE targets with a syntax similar to Gulp tasks and typed !
View TypedTaskDefinitionHelper.fs
/// Allow to define FAKE tasks with a syntax similar to Gulp tasks and using instances instead of strings
module BlackFox.TypedTaskDefinitionHelper
open Fake
open System
type TaskMetadata = {
name: string
dependencies: TaskInfo list
You can’t perform that action at this time.