Skip to content

Instantly share code, notes, and snippets.

Tom Boutell boutell

Block or report user

Report or block boutell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View apostrophe-caches-index.js
self.getCollection = function(callback) {
return self.apos.db.collection('aposCache', function(err, collection) {
if (err) {
return callback(err);
self.cacheCollection = collection;
return async.series({
keyIndex: function(callback) {
return self.cacheCollection.ensureIndex({ key: 1, cache: 1 }, { unique: true }, callback);
View elasticsearch.json
"body": [
"_index": "testaposdocsdefault",
"_type": "aposDoc",
"_id": "cjnyogcfp0001n3uktsbndy6m"
"type": "apostrophe-global",
"typeESExact": "apostrophe-global",
View ApostropheStringField-sample-2.js
import ApostropheFieldMixin from '../mixins/ApostropheFieldMixin.js';
export default {
mixins: [ ApostropheFieldMixin ],
name: 'ApostropheStringField',
methods: {
validate(value) {
if (this.field.required) {
if (!value.length) {
return 'required';
View ApostropheFieldMixin-sample-1.js
module.exports = {
props: {
value: Object,
field: Object,
context: Object
data() {
return {
next: ( !== undefined) ? : (this.field.def || ''),
error: false
View ApostrophePiecesInsertModal-sample-1.vue
<ApostropheModal @close="$emit('close')">
<template slot="header">
<p>New {{ options.label }}</p>
<template slot="body">
<ApostropheSchemaEditor :fields="options.schema" v-model="pieceInfo" />
<template slot="footer">
<slot name="footer">
View ApostropheStringField-sample-1.vue
<ApostropheFieldset :field="field" :error="error">
<template slot="body">
<input v-model="next" />
View ApostropheFieldset-sample-1.vue
<fieldset :class="cssClass">
<label class="apos-field-label">{{ field.label }}</label>
<div v-if="" class="apos-field-help">{{ }}</div>
<slot name="body"></slot>
View ApostropheSchemaEditor-sample-1.vue
<div class="apos-schema">
v-for="field in fields"
boutell / gist:db0ca16e4b6de7a592cb79a4ed4a700c
Created Aug 17, 2018
mongodb query for first array element being "null" does not obey the usual "undefined properties match null" rule
View gist:db0ca16e4b6de7a592cb79a4ed4a700c
// This will find "bar" and "woo". But it does not find "foo".
(function() {
title: 'foo',
ids: []
}, {
title: 'bar'
}, {
boutell / gist:8ea95b723b253cc697607a1cc51dd5fb
Created Mar 22, 2018
Apostrophe CMS addColumns example
View gist:8ea95b723b253cc697607a1cc51dd5fb
name: 'title',
label: 'Title'
name: 'updatedAt',
label: 'Last Updated',
partial: function(value) {
if (!value) {
You can’t perform that action at this time.