This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import History from './history'; | |
import Barba from 'barba.js'; | |
const history = new History(); | |
Barba.Pjax.goTo = function(url) { | |
history.goTo(url); | |
this.onStateChange(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Barba from 'barba.js'; | |
import mud from '../loader/behaviour'; | |
import events from '../helpers/events'; | |
import { transitionEnd, css3 } from '../helpers/prefix'; | |
import Tweezer from 'tweezer.js'; | |
export const views = () => { | |
const heroClassName = 'is-page-with-hero'; | |
const heroWithOutClassName = 'is-page-without-hero'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BARBA.JS INIT and Page transitions | |
var ExpandTransition = Barba.BaseTransition.extend({ | |
start: function() { | |
Promise | |
.all([this.newContainerLoading, this.zoom()]) | |
.then(this.showNewPage.bind(this)); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /app/javascript/packs/application.js | |
import Barba from 'barba.js' | |
import {HideShowTransition, FadeTransition} from '../barbaTransitions' | |
/** | |
* | |
* @param {Element} conatainerElement | |
*/ | |
function initAll(conatainerElement) { | |
// initialize all js scripts inside conatainerElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Internally, do something like this | |
Promise | |
.all([ | |
this.loadNewContent, | |
this.transitionOut({ | |
fromRoute, | |
event, | |
oldContainer, | |
promise |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i openai dotenv | |
import { config } from 'dotenv'; | |
config(); | |
// OpenAI API Configuration | |
import { Configuration, OpenAIApi } from "openai"; | |
const configuration = new Configuration({ | |
apiKey: process.env.OPENAI_API_KEY, // Replace this with your key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const path = require('path') | |
const inquirer = require('inquirer') | |
const replace = require('replace-in-file') | |
const isCI = require('is-ci') | |
const spawn = require('cross-spawn') | |
const fileGlob = process.argv[2] || 'src/**/*.*' | |
const files = path.isAbsolute(fileGlob) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs/promises') | |
const fetch = require('make-fetch-happen').defaults({ | |
cacheManager: './node_modules/.cache/make-fetch-happen', | |
}) | |
const csv = require('csvtojson') | |
const {CONVERT_KIT_API_KEY, CONVERT_KIT_API_SECRET} = process.env | |
const levels = ['standard-testing', 'basic-testing', 'pro-testing'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CacheMetadata = { | |
createdTime: number | |
maxAge: number | null | |
expires: number | null | |
} | |
function shouldRefresh(metadata: CacheMetadata) { | |
if (metadata.maxAge) { | |
return Date.now() > metadata.createdTime + metadata.maxAge | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('make-fetch-happen').defaults({ | |
cacheManager: './node_modules/.cache/make-fetch-happen', | |
}) | |
// add a .env file that has this in it: | |
// CONVERT_KIT_API_KEY=some_api_key | |
// CONVERT_KIT_API_SECRET=some_api_secret | |
require('dotenv').config() | |
const {CONVERT_KIT_API_KEY, CONVERT_KIT_API_SECRET} = process.env |