Skip to content

Instantly share code, notes, and snippets.

View indreklasn's full-sized avatar
👋

Trevor I. Lasn indreklasn

👋
View GitHub Profile
exports.handler = (event, context) => {
console.log('Lambda Function `products-read-all` invoked')
return client.query(q.Paginate(q.Match(q.Ref('indexes/all_products'))))
.then((response) => {
const productRefs = response.data
// create new query out of todo refs.
// https://docs.fauna.com/fauna/current/api/fql/
const getAllProductDataQuery = productRefs.map((ref) => {
return q.Get(ref)
[build]
functions = "functions"
# This will be run the site build
command = "npm run build"
# This is the directory is publishing to netlify's CDN
publish = "build"
[dev]
# Local dev command. A.k.a npm start
command = "react-scripts start"
exports.handler = (event, context, callback) => {
// "event" has information about the path, body, headers, etc. of the request
console.log('event', event)
// "context" has information about the lambda environment and user details
console.log('context', context)
// The "callback" ends the execution of the function and returns a response back to the caller
return callback(null, {
statusCode: 200,
body: JSON.stringify({
data: 'hello world'
/* bootstrap database in your FaunaDB account */
const readline = require('readline')
const faunadb = require('faunadb')
const chalk = require('chalk')
const insideNetlify = insideNetlifyBuildContext()
const q = faunadb.query
console.log(chalk.cyan('Creating your FaunaDB Database...\n'))
// 1. Check for required enviroment variables
import { define } from 'hybrids';
const MyElement = {
count: 0,
render: ({ count }) => {...},
};
define('my-element', MyElement);
import { html, define } from 'hybrids';
export function increaseCount(host) {
host.count += 1;
}
export const SimpleCounter = {
count: 0,
render: ({ count }) => html`
<button onclick="${increaseCount}">
axe.run(function (err, results) {
if (err) throw err;
ok(results.violations.length === 0, 'Should be no accessibility issues');
// complete the async call
...
});
const React = require('react');
const ReactDOM = require('react-dom');
if (process.env.NODE_ENV !== 'production') {
const axe = require('react-axe');
axe(React, ReactDOM, 1000);
}
AOS.init();
// You can also pass an optional settings object
// below listed default settings
AOS.init({
// Global settings:
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
startEvent: 'DOMContentLoaded', // name of the event dispatched on the document, that AOS should initialize on
initClassName: 'aos-init', // class applied after initialization
animatedClassName: 'aos-animate', // class applied on animation
import { createSelector } from "reselect";
const selectAllPets = state => state.pets.data;
export const selectAllDogs = createSelector(
selectAllPets,
allPets => allPets
);