Skip to content

Instantly share code, notes, and snippets.

View titouancreach's full-sized avatar

Titouan CREACH titouancreach

  • Lorient, France
  • 08:29 (UTC +01:00)
View GitHub Profile
@titouancreach
titouancreach / uEye.cpp
Last active January 10, 2017 08:55
Plus besoin de fonction init !
#include <iostream>
#include <cstdlib>
typedef int handle_type;
namespace uEye
{
class uEye
const expr = ["min", ["max", 0.5, ["toto", 1, 2]],1];
const env = {
'eegle:min': Math.min,
'eegle:max': Math.max,
'UI:COMPONENT': function (x) {
console.log('Component called', x);
return 1;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const addTodo = todoItem => {type: 'ADD_TODO', payload: {todoItem}};
open Util;
[@bs.module "semantic-ui-react"] external button : ReasonReact.reactClass = "Button";
let make = (children) =>
ReasonReact.wrapJsForReason(
~reactClass=button,
children
);
@titouancreach
titouancreach / compose.js
Last active March 27, 2018 12:30
compose function written in recursive
export function compose(...fns) {
if (fns.length === 0) {
return fns;
}
return value => {
const g = fnsAcc => {
if (fnsAcc.length === 1) {
return fnsAcc[0](value);
}
const [head, ...tail] = fnsAcc;
const state = {
dataset: [{
name: 'dataset1',
template: 0
}, {
name: 'dataset2',
template: 1
}],
template: {
0: {
@titouancreach
titouancreach / wow.exs
Last active June 16, 2018 20:32
[a, b, c, d] to [{a, b}, {c, d}] in elixir
def make(s) do
case (s) do
[line, sens | rest] -> [{line, sens} | make(rest)]
[] -> []
end
end
const matchString = (s, patterns) => {
if (patterns.length === 0) {
throw new Error('Not exhaustive string matching');
}
const [matching, ...rest] = patterns;
const [re, fn] = matching;
if (re.test(s)) {
const matches = re.exec(s);
return matches ? fn(...matches) : fn();
}