Skip to content

Instantly share code, notes, and snippets.

View mornir's full-sized avatar
🎮
Gaming

Jérôme Pott mornir

🎮
Gaming
View GitHub Profile
@mornir
mornir / netlify.toml
Created July 20, 2025 07:07
Prefix default locale Netlify
[[redirects]]
from = "/"
to = "/fr/"
status = 302
conditions = { Language = ["fr"] }
[[redirects]]
from = "/"
to = "/de/"
status = 302
@mornir
mornir / custom_fn.groq
Created July 12, 2025 16:00
GROQ custom function
fn utils::expandLink($lang) = $lang[]{
...,
markDefs[]{
...,
_type == "internalLink" => {
"slug": @.reference->number,
"type": @.reference->_type,
}
}
};
@mornir
mornir / Gate.astro
Created June 17, 2025 13:10
Very Basic Gated Content with AlpineJS
<div
x-cloak
x-data="{ showGate: $persist(true), password: '', showError: false }"
x-show="showGate"
class="absolute inset-0 z-20 bg-white"
x-trap.noscroll="showGate"
>
<div class="mx-auto prose px-4 pt-12">
<h1>Projekt Digitale BSV 2026</h1>
<form
const blocks = `blocks[] {
...,
photos[] {
...,
"metadata": asset->metadata,
},
markDefs[] {
...,
_type == "internalLink" => {
"slug": @->slug.current,
@mornir
mornir / schema.js
Created February 7, 2021 16:01
Unused schema snippet for terminofeu
{
name: 'collection',
title: 'Terminologiesammlung',
type: 'string',
options: {
list: [{ title: 'BSV 10-15', value: 'bsv_10-15' }],
},
},
{
name: 'domain',
@mornir
mornir / deskStructureWithRoles.js
Created September 19, 2020 18:12
Simple example on how to return a structure depending on the logged in user‘s role.
import S from '@sanity/base/structure-builder'
import userStore from 'part:@sanity/base/user'
// remember to add rxjs/operators to your dependencies with npm or yarn
import {
map
} from 'rxjs/operators'
export default () => userStore.currentUser.pipe(
map(({user}) => {
const {role} = user
@mornir
mornir / easings.css
Created July 25, 2020 15:42 — forked from argyleink/easings.css
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
@mornir
mornir / mailchimp_netlify_form.js
Created June 24, 2020 18:51
Submit email to Mailchimp via Netlify Form. Delete data from Netlify after submission to Mailchimp.
const axios = require('axios')
const crypto = require('crypto')
const region = process.env.MAILCHIMP_API_KEY.split('-')[1]
const apiRoot = `https://${region}.api.mailchimp.com/3.0/lists/${process.env.MAILCHIMP_LIST_ID}/members/`
function deleteSubmission(id) {
const url = `https://api.netlify.com/api/v1/submissions/${id}?access_token=${process.env.NETLIFY_ACCESS_TOKEN}`
return axios.delete(url)
@mornir
mornir / cron_job.yml
Created February 25, 2020 18:38
Trigger Sanity Backup through serverless function
name: Trigger Backup
on:
schedule:
# Runs at 04:00 UTC on the 1st and 17th of every month
- cron: '0 4 */16 * *'
jobs:
build:
name: Trigger Netlify Function
runs-on: ubuntu-latest
steps:
@mornir
mornir / challenge-1.js
Last active January 3, 2020 19:07
GROQ Pokédex Challenges
// Find the weakest Pokémon overall
*[]{
"overall": base.HP + base.Attack + base.Defense + base["Sp. Attack"] + base["Sp. Defense"] + base.Speed,
"name": name.english,
}|order(overall)[0]