Skip to content

Instantly share code, notes, and snippets.

View sbaechler's full-sized avatar

Simon Bächler sbaechler

View GitHub Profile
@SimeonC
SimeonC / i18nextLanguageJson.ts
Last active May 15, 2024 02:04
Using Webpack code-split "backend" for i18next translations. Note that your withTranslations/useTranslations must use namespaces or include a default namespace or the read function doesn't get called
// Used for one JSON file for each language containing all namespaces
i18next.use({
type: 'backend',
read<Namespace extends keyof typeof en>(
language: LocaleCode,
namespace: Namespace,
callback: (
errorValue: unknown,
translations: null | typeof en[Namespace]
) => void
@ahmad2smile
ahmad2smile / setupTests.ts
Created March 8, 2021 11:15
Mock Missing SVG Functions in JSDom for Jest
beforeEach(()=>{
Object.defineProperty(global.SVGSVGElement.prototype, 'createSVGMatrix', {
writable: true,
value: jest.fn().mockImplementation(() => ({
martix: jest.fn(() => [[]]),
a: 0,
b: 0,
c: 0,
d: 0,
@rodneyrehm
rodneyrehm / sentry-clean-debug-information-files.js
Created July 17, 2019 15:19
Sentry Cleanup: Debug Information Files
const axios = require('axios')
const LinkHeader = require('http-link-header')
const nextPage = (header) => {
const link = LinkHeader.parse(header)
const [ next ] = link.get('rel', 'next')
return next && next.results === 'true' ? next.uri : null
}
@kevinSuttle
kevinSuttle / meta-tags.md
Last active May 12, 2024 15:28 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@schmidsi
schmidsi / feincms_ajax.js
Created September 7, 2011 14:10
FeinCMS ajax client side
var ajax_links_selector = 'a.ajax';
var content_selector = '#content';
var first_call = true;
var navilevel_substring = 3; // how many chars from pathname are static (3 for languagecode like /de/)
/* needs jquery address loaded: http://www.asual.com/jquery/address/
*
* needs feincms to be ajax-enabled:
*
* feincms/views/base.py: