Skip to content

Instantly share code, notes, and snippets.

View yloiseau's full-sized avatar

Yannick Loiseau yloiseau

View GitHub Profile
module TestObservable
function main = |args| {
let o1 = Observable(null)
let o2 = o1: map(|v| -> v + 1): onChange(|v| {println(v)})
o1: set(0)
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2016 Yannick Loiseau <me@yloiseau.net>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
"""
on-modify hook for taskwarrior.
This hook connects taskwarrior and watson.
@yloiseau
yloiseau / watson-conky.md
Last active May 27, 2016 08:14
Watson i3 status (via conky)

To display the current watson status in your i3 bar using conky:

  • in the conky configuration, add:
{"full_text": "${texeci 5 ~/.config/i3/watson-status}"}
  • in ~/.config/i3/watson-status:
#!/bin/bash
watson status |
sed -r '
#!/bin/bash
#
# Copyright © 2016 Yannick Loiseau <me@yloiseau.net>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
#
#==============================================================================
# Script to check if you are working on a project with Watson and display a
# notification when:
module checks
function checkWithFallback = |log, message, predicate, fallback| -> |value| {
case {
when predicate(value) {
return value
}
otherwise {
log: add(message)
log: add("use %s instead": format(fallback))
@yloiseau
yloiseau / FirstOrderModule.md
Created January 15, 2016 11:27
First order modules in Golo

Just a POC on a discussion we had with @Artpej

Given

module MyMod

function foo = |a, b| -> a + b

function bar = -&gt; println("MyMod.bar")
module Test
# in reply to https://github.com/TypeUnsafe/golo-x/blob/master/main.functional.golo#L8
import gololang.Errors
@result
function divide = |a,b| -> a / b
Verifying that +yloiseau is my blockchain ID. https://onename.com/yloiseau
@yloiseau
yloiseau / wtf.md
Created July 24, 2015 10:12
golo concurrency

What am I missing?

java:

import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ExecutorService;

import static java.util.concurrent.Executors.newCachedThreadPool;
@yloiseau
yloiseau / Overloading.md
Last active August 29, 2015 14:21
multimethod macro

Just a test for a macro to allow overloading existing functions! (actually, a multimethod generic dispatch)

NOTE: this is just a POC to eat my own dog food...

module A

function foo = |a, b, c| {
  return "A::foo"
}