This file contains 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'); | |
const path = require('path'); | |
/** | |
* Sorts the keys of a JSON object alphabetically and returns a new sorted object | |
* | |
* @param {Object} obj - The JSON object to sort | |
* @returns {Object} - A new object with sorted keys | |
*/ | |
function sortObjectKeys(obj) { |
This file contains 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'); | |
const path = require('path'); | |
const https = require('https'); | |
/** | |
* Translates text using Google Translate API (free method) | |
* | |
* @param {string} text - Text to translate | |
* @param {string} targetLang - Target language code (e.g., 'es', 'fr', 'de') | |
* @returns {Promise<string>} - Translated text |
This file contains 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
/** | |
* CSS Build Analyzer | |
* | |
* Analyzes CSS files in an Astro build output directory, generating statistics and | |
* processed versions for analysis. | |
* | |
* Usage: | |
* 1. Place this script in your Astro project | |
* 2. Run after building: node analyze-css.js | |
* |
This file contains 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
AbTesting | |
Abacus | |
AbjadArabic | |
AbjadHebrew | |
AbugidaDevanagari | |
AbugidaThai | |
AccessPoint | |
AccessPointCheck | |
AccessPointMinus | |
AccessPointNetwork |
This file contains 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 badFieldName = Object.keys(self.fields).indexOf('type') !== -1; | |
if (badFieldName) { | |
throw new Error('@apostrophecms/piece-type field property name cannot be "type"'); | |
} |
This file contains 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 t = require('../test-lib/test.js'); | |
const assert = require('assert'); | |
let apos; | |
const apiKey = 'this is a test api key'; | |
describe('Pieces malformed', function () { | |
this.timeout(t.timeout); | |
after(async function () { |
This file contains 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 VueLoaderPlugin = require('vue-loader/lib/plugin'); | |
const path = require('path'); | |
module.exports = { | |
// When not in production, refresh the page on restart | |
options: { | |
refreshOnRestart: true | |
}, | |
webpack: { | |
extensions: { |
This file contains 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
module.exports = { | |
... | |
middleware(self, options) { | |
return { | |
checkLanguage(req, res, next) { | |
// if you are only doing this for the homepage, check that is the page being requested | |
// possibly using req.originalUrl or the url property | |
// https://v3.docs.apostrophecms.org/reference/module-api/module-overview.html#middleware-self | |
// make sure | |
// if not a page you need to redirect just return next() |
This file contains 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 translate = require('google-translate-api-x'); | |
async function translateIt(file) { | |
try { | |
// read file and parse it as JSON | |
const data = await fs.readFile(file, 'utf8'); | |
const obj = JSON.parse(data); | |
// prepare an array of translation keys and an array of translation strings |
This file contains 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
// Define the component | |
Vue.component('gradient-picker', { | |
// The component's options go here | |
data() { | |
return { | |
angle: 0, // The angle of the gradient | |
colors: [ // An array of objects representing the gradient's colors | |
{ | |
color: '#000000', // The color's hex code | |
start: 0, // The color's start position in the gradient (as a percentage) |
NewerOlder