Skip to content

Instantly share code, notes, and snippets.

View javierguzman's full-sized avatar
🙂
Happy Coding

Francisco Javier Guzmán Jiménez javierguzman

🙂
Happy Coding
View GitHub Profile
@javierguzman
javierguzman / supabase.ts
Created February 26, 2023 08:58
RN notifications with supabase
// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
import { serve } from 'https://deno.land/std@0.131.0/http/server.ts';
import { default as axiod } from 'https://deno.land/x/axiod@0.26.2/mod.ts';
import * as djwt from 'https://deno.land/x/djwt@v2.2/mod.ts';
import * as types from './types';
serve(async (req) => {
@javierguzman
javierguzman / blog-backend-deployment.yml
Created August 1, 2022 18:15
Strapi K8S configuration
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog-backend-deployment-$VERSION
spec:
replicas: 1
selector:
matchLabels:
subsystem: blog-backend-$VERSION
strategy:
const PrivateRoute: React.FC<PrivateRouteProps> = ({
component: Component,
requiredPermission,
logout,
...rest
}) => {
const userIsLoggedIn = useAppSelector(state => isLoggedIn(state));
const userRoles: string[] = useAppSelector(state => getRoles(state));
const { t } = useTranslation('auth');
@javierguzman
javierguzman / ingress-setup-production.yml
Created October 12, 2021 04:47
My ingress configuration
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blabla-ingress-setup-$VERSION
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: 'true'
cert-manager.io/cluster-issuer: 'blabla-issuer-production'
cert-manager.io/issue-temporary-certificate: "true"
acme.cert-manager.io/http01-edit-in-place: "true"
@javierguzman
javierguzman / Landing.story.js
Created September 30, 2021 05:01
Storybook Gist with addon-links
import React from 'react';
import Landing from '../Landing';
import notes from './readme.md';
export default {
title: 'Common/Landing',
component: Landing,
parameters: {
notes: { notes }
}
@javierguzman
javierguzman / Footer.story.js
Created September 28, 2021 20:08
Storybook with react-router
export default {
component: Footer,
title: 'Common/Footer',
parameters: {
notes: { notes }
}
}
const Template = (args) => <Footer {...args} />;
@javierguzman
javierguzman / Header.story.js
Created September 23, 2021 07:54
Storybook with Redux store
import React from 'react';
import Header from '../Header';
import notes from './readme.md';
export default {
component: Header,
title: 'Common/Header',
parameters: {
notes: { notes }
}
@javierguzman
javierguzman / matomo-server-config.yml
Created September 7, 2021 07:38
Matomo in Kubernetes
kind: ConfigMap
apiVersion: v1
metadata:
name: matomo-server-configmap-$VERSION
data:
matomo-php-config: |
memory_limit=1536M
max_execution_time=1440
matomo-nginx-fastcgi: |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@javierguzman
javierguzman / LanguageManager.tsx
Created August 31, 2021 19:55
Handling i18next cookies depending on whether the user accepts them or not
const LanguageManager: React.FC = ({ children }): JSX.Element => {
const { areCookiesSaved } = useSelector(selectCookiesConsent);
const [languageManagerCurrentInstance, setLanguageManagerCurrentInstance] = useState(
getInitialLanguageManager()
);
useEffect(() => {
if (areCookiesSaved) {
setLanguageManagerCurrentInstance(getLanguageManagerWithCookies());
}
@javierguzman
javierguzman / docker-compose-testing.yml
Last active March 28, 2021 14:10
Gitlab CI test stage
version: '3.5'
services:
testing_server:
depends_on:
- testing_database
environment:
- A_BUNCH_OF_VARIABLES=${A_BUNCH_OF_VARIABLES}
image: ${SERVER_TESTING_IMAGE_NAME}:${COMMIT_REF}
container_name: testing_server
build: