Skip to content

Instantly share code, notes, and snippets.

View stefanoverna's full-sized avatar

Stefano Verna stefanoverna

View GitHub Profile
@stefanoverna
stefanoverna / gist:371f009900bbe9ceec208f5dd1688737
Created April 13, 2016 07:39
List of interests/sports/hobbies
3D printing
Abseiling
Acting
Action figure
Adventure racing
Aerobatics
Aeromodeling
Aggressive inline skating
Aid climbing
Aikido
diff --git a/.gitignore b/.gitignore
index 3565e0d..4014c5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ src/_data
src/_works
src/about.md
src/index.md
+src/assets
public
var Dato = require('datocms-client');
var Loader = require('datocms-client/lib/local/Loader');
const client = new Dato.SiteClient('XXX');
const loader = new Loader(client);
loader.load().then(() => {
const dato = loader.itemsRepo;
// ok, now "dato" exposes everything contained in the space with a friendly API:
new SpikeDatoCMS({
addDataTo: locals,
token: 'xxx',
templates: [
{
collection: (dato) => dato.blogPosts,
path: 'templates/post.html',
output: (post) => { return `posts/${post.slug}.html` }
}
]
source "https://rubygems.org"
ruby "2.3.1"
gem "active_model_serializers", "0.10.0.rc4"
gem "addressable"
gem "aws-sdk"
gem "bcrypt"
gem "email_validator"
gem "faraday"
source "https://rubygems.org"
ruby "2.3.1"
gem "rails", "5.0.0.1"
gem "rails-i18n"
gem "pg"
gem "active_model_serializers", "~> 0.10.0"
gem "activerecord-session_store"
gem "acts-as-taggable-on",
const htmlTag = require('html-tag');
const stringifyObject = require('stringify-object');
const toHtml = (tags) => (tags.map(({tagName, attributes, content}) => (htmlTag(tagName, attributes, content))).join(""));
module.exports = (dato, root, i18n) => {
i18n.availableLocales.forEach((locale) => {
i18n.withLocale(locale, () => {
root.createPost(`content/_index.${locale}.md`, 'yaml', {
frontmatter: {
title: dato.index.title,
source "https://rubygems.org"
gem "unsplash"
[
"https://1a3a62c54d955c8749cc9-admin.hardypress.com/sitemap.xml"
]
@stefanoverna
stefanoverna / dato.config.js
Last active March 13, 2023 05:22
Simple backup of DatoCMS content
// First option:
// This will dump every content of a DatoCMS space in the "backup" directory
// To be used with the `dato dump` command (see https://docs.datocms.com/other/basic-usage.html)
module.exports = (dato, root, i18n) => {
i18n.availableLocales.forEach(locale => {
root.directory(`backup/${locale}`, localeDir => {
dato.itemTypes.forEach(itemType => {
localeDir.createDataFile(
`${itemType.apiKey}.json`,