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 / porting.cpp
Created March 6, 2020 14:46
Porting Scenarios
// Scenario 1 -> default behavior keeps changing:
// TODAY
#if defined(PORTING_X)
useMemory1()
#else
useMemory2()
#endif
//TOMORROW
#if defined(PORTING_X)
@javierguzman
javierguzman / TermsAndConditions.tsx
Created July 19, 2020 13:40
Example of terms and conditions in different languages using markdown and dynamic import
import React, { useEffect, useState } from 'react';
import i18next from 'i18next';
import { getCurrentLanguage } from '@Utils/language';
import ReactMarkdown from 'react-markdown';
import Loader from '@Loader';
type MarkdownContent = string | undefined;
const TermsAndConditions = (): JSX.Element => {
const currentLanguage = getCurrentLanguage(i18next.languages); // it returns i18next.languages[0] -> 'es', 'fr', 'en' etc.
const [getTermsAndConditions, setTermsAndConditions] = useState<MarkdownContent>(undefined);
@javierguzman
javierguzman / pactl-list-short-output-1.txt
Created September 14, 2020 05:46
Output of pactl list short
0 module-device-restore
1 module-stream-restore
2 module-card-restore
3 module-augment-properties
4 module-switch-on-port-available
5 module-switch-on-connect
6 module-udev-detect
7 module-alsa-card device_id="0" name="pci-0000_01_00.1" card_name="alsa_card.pci-0000_01_00.1" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"
8 module-alsa-card device_id="1" name="pci-0000_00_1f.3-platform-skl_hda_dsp_generic" card_name="alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"
9 module-bluetooth-policy
@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:
@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 / 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 / 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 / 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 / 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 / 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"