Skip to content

Instantly share code, notes, and snippets.

View jslyonnais's full-sized avatar
🌲
Go green & code.

Jean-Simon Lyonnais jslyonnais

🌲
Go green & code.
  • Freelance
  • Quebec, Canada
View GitHub Profile
@jslyonnais
jslyonnais / acf-page.php
Last active January 6, 2022 16:46
WordPress + ACF - Register fields via PHP
<?php
add_action( 'acf/init', 'register_allpage_fields' );
function register_allpage_fields() {
$slug = "allpage";
$fields = [
[
'key' => 'page_subtitle',
'label' => 'Subtitle',
'name' => 'page_subtitle',
@jslyonnais
jslyonnais / settings.json
Created June 3, 2021 14:10
PostCSS Sorting config for VS Code
"postcssSorting.config": {
"order": [
"custom-properties",
"dollar-variables",
"declarations",
"at-rules",
"rules"
],
"properties-order": [
"box-sizing",
@jslyonnais
jslyonnais / acf-php-to-json.php
Created July 10, 2020 13:43 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@jslyonnais
jslyonnais / 0-Unable-Storyblok-Gatsby-Preview.md
Last active November 21, 2019 16:19
Unable preview in Storyblok while using Gatsby & React hooks

Unable preview in Storyblok while using Gatsby & React hooks

  • Install dependencies : gatsby-source-storyblok, storyblok-react, react, gatsby
  • Add Storyblok accessToken in your gatsby-config.js
{
  resolve: 'gatsby-source-storyblok',
  options: {
    homeSlug: 'home',
 version: process.env.BUILD_ENV === 'production' ? 'published' : 'draft',
@jslyonnais
jslyonnais / alert.js
Last active August 2, 2019 17:00
Reactjs Alert component using ServiceWorker for PWA - for article purpose
import React from 'react'
import { NotificationImportant } from '@material-ui/icons'
import { alertType } from './enums/alertType'
import { alertMessage } from './enums/alertMessage'
import './Alert.scss'
export default class Alert extends React.Component {
state = {
isDisplay: false,
@jslyonnais
jslyonnais / UploadToAzure.ps1
Last active July 12, 2023 16:59
Upload to Azure via FTP using Powershell Script
# Declare and initialize script variables
$appdirectory = "."
$webappname = "WEB_APP_NAME"
$location = "Central US"
$ressourceGroup = "RESSOURCE_GROUP_NAME"
# Create a resource group, if it does not exist
# Use the -Force flag to avoid getting a prompt asking for confirmation
New-AzureRmResourceGroup -Name $ressourceGroup -Location $location -Force
const fs = require('fs')
const YAML = require('json-to-pretty-yaml')
const configPath = '/static/admin'
const configs = require('require-all')(__dirname + `${configPath}/config`)
let obj = {
'backend': {},
'collections': []
}
const createNewCollectionsType = (category, name) => {
{
"label": "{{lang}}_articles",
"name": "{{lang}}_articles",
"folder": "src/pages/articles/{{lang}}",
"create": true,
"slug": "{{slug}}",
"fields": [
{
"label": "Langue",
"name": "language",
@jslyonnais
jslyonnais / script-concat-multilanguages-config.js
Last active February 21, 2019 15:45
Gatsby & NetlifyCMS concatenate script with multilanguages support
const fs = require('fs')
const YAML = require('json-to-pretty-yaml')
const configPath = '/static/admin'
const configs = require('require-all')(__dirname + `${configPath}/config`)
const languages = ['fr', 'en']
let obj = {
'backend': {},
'collections': []
}