Skip to content

Instantly share code, notes, and snippets.

View titouancreach's full-sized avatar

Titouan CREACH titouancreach

  • Lorient, France
  • 07:11 (UTC +02:00)
View GitHub Profile
import { NodeRuntime } from "@effect/platform-node";
import { Schema } from "@effect/schema";
import { startConsumer } from "consumer";
import { Console, Effect, LogLevel, Logger, pipe } from "effect";
const consumer = startConsumer({
queueName: "QueueName",
processFunc: (message) => {
return Console.log("Treated !!", message);
},
import {
DeleteMessageCommand,
ReceiveMessageCommand,
} from "@aws-sdk/client-sqs";
import { Schema } from "@effect/schema";
import { SqsLive, SqsService, getSqslient } from "@repo/shared/src/Sqs";
import { Array, Effect, Option, Schedule, pipe } from "effect";
import { logDebug, logError, logWarning } from "effect/Effect";
function takeFromSqs({ queueUrl }: { queueUrl: string }) {
import { NodeRuntime } from "@effect/platform-node";
import { Schema } from "@effect/schema";
import { SqsLive, SqsService } from "@repo/shared/src/Sqs";
import { Chunk, Console, Effect, Option, Stream, pipe } from "effect";
import { logError, logInfo } from "effect/Effect";
import { Consumer } from "sqs-consumer";
function makeStream<T, U>({
queueName,
@titouancreach
titouancreach / interpolated.lua
Created September 6, 2023 12:35
interpolated string C#
{
"InsertCharPre",
{
pattern = { "*.cs" },
--- @param opts AutoCmdCallbackOpts
--- @return nil
callback = function(opts)
-- Only run if f-string escape character is typed
if vim.v.char ~= "{" then return end
using System;
using System.Text;
using Microsoft.AspNetCore.WebUtilities;
namespace LiveBoat.Web.Services
{
public class ImageProxyOptions
{
public int? Width { get; set; }
public int? Height { get; set; }
let ( |> ) x f = f x;;
let printarray a =
let rec printlist = function
| head :: rest -> print_char head; printlist rest;
| [] -> print_newline () in
printlist (Array.to_list a);;
@titouancreach
titouancreach / what-forces-layout.md
Created October 19, 2018 08:14 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
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();
}
@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 state = {
dataset: [{
name: 'dataset1',
template: 0
}, {
name: 'dataset2',
template: 1
}],
template: {
0: {