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 / accounting.factory.transaction.clj
Last active November 7, 2022 17:37
Answer to @puredanger's tweet: about the «trouble» I had first using type hints and records in Clojure.
(ns accounting.factory.transaction
(:require [accounting.model.transaction :as transaction]
[accounting.model.document :as document]
[accounting.model.movement :as movement])
(:import [accounting.model.transaction Transaction]
[accounting.model.document Document]
[org.joda.time LocalDate]))
(defn create-exchange-difference
^Transaction
@olange
olange / graphviz-build-system-for-sublime.md
Created January 4, 2015 00:21
Graphviz (DOT) Build System for Sublime Text 2 and 3

To transform the currently opened Graphviz source file (in DOT Language) into a PNG:

{
    "cmd": [ "dot", "-Tpng", "-o", "$file_base_name.png", "$file"],
    "selector": "source.dot"
}

Usage

@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 / 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 / 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-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 / 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 / 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.