Skip to content

Instantly share code, notes, and snippets.

View olange's full-sized avatar
🚀

Olivier Lange olange

🚀
View GitHub Profile
@olange
olange / sendAllDrafts.vba
Last active April 30, 2024 11:34
Sends all draft e-mails from a specific Outlook folder
Option Explicit
Private Const VERSION As String = "0.1"
Private Const DIALOG_TITLE As String = "yourModuleName › SendAllDrafts (v" & VERSION & ")"
' Name of the subfolder of the Drafts folder, containing the draft e-mails to be sent
Private Const MAILMERGE_SUBFOLDER_NAME = "MailMerge"
' Send all messages from the MAILMERGE_SUBFOLDER_NAME subfolder
' of the Drafts folder (ignores any subfolder)
@olange
olange / keybase.md
Last active October 20, 2020 21:24
GitHub account ownership proof for Keybase

Keybase proof

I hereby claim:

  • I am olange on github.
  • I am olange (https://keybase.io/olange) on keybase.
  • I have a public key ASBzFUPXlmMy_SpQTjo49LfCtBcPz1FcBbrH8pGTLPxWVgo

To claim this, I am signing this object:

@olange
olange / google-firebase-functions-list-available-executables.js
Last active February 8, 2021 06:18
List of executables available in Firebase Cloud Functions Node.js runtime
/**
* List of executables in Cloud Functions runtime.
* Invoke with https://us-central1-‹project-name›.cloudfunctions.net/ls
*/
const functions = require( "firebase-functions");
const spawn = require( "child-process-promise").spawn;
const ls = (req, res) => {
console.log( "Listing contents of /usr/[local/][s]bin");
return spawn( "ls",
@olange
olange / graphqlScalarURLType.coffee
Created January 30, 2017 14:58
A custom GraphQL scalar type that represents an URL (Uniform Resource Locator) and promises to verify that a given URL string has a valid syntax.
exp = module.exports = {}
url = require "url"
type = require "component-type"
graphql = require "graphql"
graphql_language = require "graphql/language"
graphql_error = require "graphql/error"
{ GraphQLScalarType } = graphql
{ GraphQLError } = graphql_error
@olange
olange / type-yatd.coffee
Created January 19, 2017 18:30
Yet another type detective – CoffeeScript version of the type `component/type` NPM package
#
# A less-broken `typeof` function. CoffeeScript version of the
# `component/type` NPM package [1].
#
# See also:
#
# [1] https://github.com/component/type/blob/master/index.js
# and https://gist.github.com/olange/2aa1abe1001c92bde78be1c84d7f1261
exp.type = (val) ->
toString = Object.prototype.toString
@olange
olange / type-detective.coffee
Last active January 19, 2017 18:31
Reliably detect types of Javascript objects and primitive values, easing polymorphic programming in JS
#
# Helper module to reliably find the types of Javascript objects
# and primitive values, easing polymorphic programming.
#
# See also:
# * http://javascript.info/tutorial/type-detection
# * https://gist.github.com/olange/514325f6fe3d89610d224d731a2def9e
exp = module.exports = {}
#
@olange
olange / user.keymap
Created May 25, 2016 10:22
My LightTable settings (intended for a CH/FR keyboard layout)
;; User keymap
;; -----------------------------
[
[:editor "alt-w" :editor.watch.watch-selection]
[:editor "alt-shift-w" :editor.watch.unwatch]
[:app "pmeta-*" :workspace.show]
[:app "pmeta-/" :toggle-console]
[:app "pmeta-shift-/" :clear-console]
[:app "pmeta-alt-/" :console-tab]
@olange
olange / nearlyEqual.coffee
Last active May 20, 2016 16:13
Near equality in CoffeeScript for Node.js (comparison with a maximum relative difference)
##
# Minimum number added to one that makes the result different than one
#
EPSILON = Number.EPSILON ? 2.2204460492503130808472633361816e-16
##
# Given two floating point numbers and the maximum relative difference
# between the two, returns true if the two numbers are nearly equal,
# false otherwise. If the maximum relative difference (aka _epsilon_)
# is undefined, the function will test whether x and y are exactly equal.
@olange
olange / measuringDuration.coffee
Created May 19, 2016 16:56
Measuring a duration of execution in Node.js
##
# Utility function to measure time intervals. Polymorphic return value:
#
# * returns either the current high-resolution real time, given no argument;
# * or the time elapsed since a given high-resolution real time, that was
# retrieved from a previous call to this function.
#
# Usage:
# t0 = hrtime()
# duration = hrtime( t0) # expressed in milliseconds
@olange
olange / symmetricDiff.coffee
Created May 13, 2016 18:12
Symmetric difference of two Sets in CoffeeScript
##
# Given two sets A and B, returns a triple with the set of elements
# in A only, in both and in B only.
#
symmetricDiff = (setA, setB) ->
[inAOnly, inBoth, inBOnly] = [new Set(), new Set(), new Set()]
setA.forEach (eid) ->
(if setB.has( eid) then inBoth else inAOnly).add eid
setB.forEach (eid) ->
inBOnly.add( eid) unless inBoth.has( eid)