Skip to content

Instantly share code, notes, and snippets.

Avatar

Yannick Loiseau yloiseau

View GitHub Profile
View test-observables.golo
module TestObservable
function main = |args| {
let o1 = Observable(null)
let o2 = o1: map(|v| -> v + 1): onChange(|v| {println(v)})
o1: set(0)
}
View on-modify-watson.py
#!/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
Watson i3 status (via conky)
View watson-conky.md

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 '
View watson-notify
#!/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:
View check.golo
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 Jan 15, 2016
First order modules in Golo
View FirstOrderModule.md

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")
View test_k33g.golo
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
View gist:452247da5f9f5a1a6102
Verifying that +yloiseau is my blockchain ID. https://onename.com/yloiseau
@yloiseau
yloiseau / wtf.md
Created Jul 24, 2015
golo concurrency
View wtf.md

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 Aug 29, 2015
multimethod macro
View Overloading.md

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"
}