Skip to content

Instantly share code, notes, and snippets.

View turingmachine's full-sized avatar

Simon Josi turingmachine

View GitHub Profile
// storeinventory module
const storeinventoryLoader = async productIds => {
return await fetch(productIds)
}
const storeinventoryTransformer = (storeinventory, product) => {
return { ...product, ...storeinventory[product.id] }
}
// excludedProducts module
const exludedProductsLoader = async productIds => {
const ProductPage = ({ store }) => {
useEffect(() => {
store.loadNotifications()
}, [])
return (
<div className="product-page">
<NotificationBar
notifications={store.notifications}
location="product page"
import React from 'react'
const JourneyContainer = () => {
return (
<div className="journey-container">
<div className="content-container">
<div className="brand-3">So einfach funktioniert’s:</div>
<div className="items-container">
<div className="content-box">
<div className="img-01" />
import React from 'react'
const JourneyContainer = () => {
return (
<div className="journey-container">
<div className="content-container">
<div className="brand-3">So einfach funktioniert’s:</div>
<div className="items-container">
<div className="content-box">
<div className="img-01" />
import React from 'react'
const JourneyContainer = () => {
return (
<div className="journey-container">
<div className="content-container">
<div className="brand-3">So einfach funktioniert’s:</div>
<div className="items-container">
<div className="content-box">
<div className="img-01" />
[
{
"id": 1,
"name": "Supermarkt"
},
{
"id": 2,
"name": "Lebensmittel",
"parent": 1
},
const openidRelyingParty = new openid.RelyingParty(
`${config.baseurl}/verify`,
config.baseurl,
true, // Use stateless verification
false, // Strict mode
[
new openid.AttributeExchange({
'https://login.migros.ch/ax/legal/TNB_MYMIGROS': 'required',
'https://login.migros.ch/ax/contact/email': 'optional',
'https://login.migros.ch/ax/person/guid': 'required',
const transformFoodDeclarations = apiFoodDeclaration => {
const boldTextRegex = /\$([^\$]+)\$/g
const producing_country =
_.get(apiFoodDeclaration, 'producing_country', null) === '-'
? null
: _.replace(
_.get(apiFoodDeclaration, 'producing_country', null),
'DE: ',
''
)
{
"total_hits": 1,
"facets": {
"purchasable_online": {
"name": "Online erhältlich",
"terms": [
{
"term": "F",
"count": 1,
"name": "Nein",
@turingmachine
turingmachine / snippets.js
Last active April 22, 2019 18:00
React / MobX / socket.io
//SERVER:
io.on('connection', socket => {
socket.on('pickingstates.update', async pickingstateMsg => {
const [pickingstate, created] = await models.Pickingstates.findOrCreate(
{
where: {
deliveryDate: pickingstateMsg.deliveryDate,
orderId: pickingstateMsg.orderId,
productId: pickingstateMsg.productId,
},