Skip to content

Instantly share code, notes, and snippets.

/**
* API docs: https://docs.strapi.io/developer-docs/latest/development/backend-customization/routes.html#creating-custom-routers
*
* @Notes: Policies are functions that are associated with roots. They are executed before each request even reaches the roots.
* Type of STRAPI policies: Global, Plugin, API
* List policies in command line: yarn strapi policies list / npm run strapi policies:list
*/
module.exports = {
routes:[
{
@biroa
biroa / VueJS 3 - JavaScript animations
Created August 13, 2022 14:29
How to use animation hooks with VueJS 3
<template>
<button type="button" @click="flag=!flag">Toggle 3</button>
<transition
@before-enter="beforeEnter"
@enter="enter"
@after-enter="afterEnter"
@before-leave="beforeLeave"
@leave="leave"
@after-leave="afterLeave"
:css="false"
<template>
<button @click="addItem">Add</button>
<ul>
<transition-group name="fade"
enter-active-class="animate__animated animate__flipInX"
leave-active-class="animate__animated animate__flipOutX"
>
<li v-for="(number,index) in numbers" :key="number"
@click="removeItem(index)"
>
<template>
<button type="button" @click="flag=!flag">Toggle 2</button>
<transition name="zoom" type="transition" appear>
<h2 v-if="flag">Hello</h2>
</transition>
</template>
<script>
...
</script>
<style>
<template>
<button type="button" @click="flag=!flag">Toggle 2</button>
<transition name="zoom" type="transition" appear>
<h2 v-if="flag">Hello</h2>
</transition>
</template>
<script>
export default {
name: 'CssAnimation',
data(){

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@biroa
biroa / php-event-listener-example.php
Created July 15, 2020 15:54 — forked from im4aLL/php-event-listener-example.php
PHP event listener simple example
<?php
class Event {
private static $events = [];
public static function listen($name, $callback) {
self::$events[$name][] = $callback;
}
public static function trigger($name, $argument = null) {
foreach (self::$events[$name] as $event => $callback) {
# It returns a list of item
# 0,1,1,2,3,5,8,13 ...
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
# Get the n-th item of the fibonacci squence
# 0,1,1,2,3,5,8,13 ...
def fibonacci(n):
n +=1
lst = [0,1]
first = 0
second = 1
#print first,second
for i in range(0,n):
third = first+second
@biroa
biroa / conversion.js
Created May 3, 2018 20:26
Reading the content of a file and store it in an immutable blob object
// We can chage the charset when we read the text from the variable
// and we can change it when we store the content of a file in an immutable blob object.
// Read file content into a blob
// Convert it to the needed charset
exports.conversion = function (str, endings) {
var reader, fileString, blob;
if (typeof endings === "undefined") {
endings = 'native'; // It can be either 'transparent' or 'native'