Skip to content

Instantly share code, notes, and snippets.

View Kapcash's full-sized avatar

Florent Catiau-Tristant Kapcash

View GitHub Profile
@Kapcash
Kapcash / twitter-banner-grid.vue
Created July 30, 2022 10:38
Vue component to create a grid of random icons
<template>
<div class="relative">
<div class="grid">
<div v-for="img in (cols * rows)" :key="img">
<img :src="getRandomImg()" alt="icon" />
</div>
</div>
</div>
</template>
@Kapcash
Kapcash / tasks.json
Created July 22, 2021 20:27
VS Code custom task (Vue component snippet)
// Place this file next to `settings.json` (/Library/Application Support/Code/User on MacOS) to be global
// Custom tasks documentation: https://code.visualstudio.com/docs/editor/tasks#_custom-tasks
// Task user input documentation: https://code.visualstudio.com/docs/editor/variables-reference#_input-variables
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
@Kapcash
Kapcash / EnumRestreint.java
Created October 24, 2019 16:04
Java Spring validator decorator to restreint possibles values from Enum
@Target({ FIELD })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = { EnumRestreintValidator.class })
public @interface EnumRestreint {
String message() default "The enum value is not included in the possibles values.";
String[] authorizedFields() default {};
Class<?>[] groups() default {};
@Kapcash
Kapcash / ObservableSequence.ts
Created September 27, 2018 12:47
Recursive observable sequence, depending on previous response and concatening results
repeatRequests(req, endpoint, callback): any{
// Array of all results, returned to the subscribe
let tempArray = [];
// Recursive lambda function to chain all observables sequentially
const recursive = (req, endpoint, callback) => {
return this.httpService.get(endpoint).pipe(
flatMap((res) => {
callback(res.data.items);
// Concat all results in the result array