Skip to content

Instantly share code, notes, and snippets.

View theodesp's full-sized avatar
🦄
Jumping over Rainbows...

Theofanis Despoudis theodesp

🦄
Jumping over Rainbows...
View GitHub Profile
@theodesp
theodesp / sign.scm
Last active August 23, 2018 12:12
Get sign of Number #scheme
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (sign number)
(cond
((< number 0) 'negative)
((= number 0) 'zero)
(else 'positive))
)
@theodesp
theodesp / leap.scm
Created August 23, 2018 12:14
Is Leap year #scheme
(import (rnrs (6)))
(use-modules ((rnrs) :version (6)))
(define (leap-year? year)
(if (and (divisible? year 4) (not (divisible? year 100)))
#t
(if (divisible? year 400)
#t
#f)))
@theodesp
theodesp / install
Created December 10, 2018 13:31
gatsby-i18next
$ npm install -g gatsby-cli
# create a new Gatsby site using the default starter
$ gatsby new i18n-starter
$ cd i18n-starter
@theodesp
theodesp / tree1
Created December 10, 2018 13:42
gatsby-i18next tree structure
$ tree -L 3 .
.
├── LICENSE
├── README.md
├── gatsby-browser.js
├── gatsby-config.js
├── gatsby-node.js
├── gatsby-ssr.js
├── package-lock.json
├── package.json
@theodesp
theodesp / required-plugins
Last active April 6, 2020 10:56
Gatsby i18next required-1
$ npm install @wapps/gatsby-plugin-i18next react-i18next gatsby-source-filesystem
@theodesp
theodesp / gatsby-config-i18next
Last active April 6, 2020 10:58
gatsby-config-i18next
module.exports = {
pathPrefix: '/gatsby-i18n/gatsby-starter-i18next',
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-plugin-manifest`,
options: {
name: 'gatsby-starter-lingui',
short_name: 'starter',
start_url: '/gatsby-i18n/gatsby-starter-i18next/',
import React from 'react';
import PropTypes from 'prop-types';
import { withTranslation } from 'react-i18next';
import { Head } from '@wapps/gatsby-plugin-i18next';
import Header from './header';
import './layout.css';
const Layout = ({ children, data, t }) => (
<>
import React from 'react';
import { Link } from '@wapps/gatsby-plugin-i18next';
import LanguageSwitcher from './languageSwitcher';
const Header = ({ siteTitle }) => (
<div
style={{
background: 'blue',
marginBottom: '1.45rem',
import React from 'react';
import { Language } from '@wapps/gatsby-plugin-i18next';
const LanguageSwitcher = ({ changeLng, lng, availableLngs }) => (
<select onChange={(e) => changeLng(e.target.value)}>
{
availableLngs.map((value) => (
<option key={value} selected={lng === value}>{value}</option>
))
};
➜ tree -L 3 locale
locale
├── el
│   └── messages.json
└── en
└── messages.json
2 directories, 2 files