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
import { readFileSync as read } from 'fs'; | |
const input:Array<number> = read('day-1.txt', { encoding: 'utf8' }) | |
.split('\n') | |
.map(line => line.trim()) | |
.filter(line => line.length > 0) | |
.map(line => parseInt(line)); |
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
// in lib/modules/pet-owners/index.js | |
module.exports = { | |
extend: 'apostrophe-pieces', | |
name: 'pet-owner', | |
addFields: [ | |
{ | |
name: 'cat', | |
label: 'Cat', | |
type: 'string' |
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
FROM node:current | |
WORKDIR /app | |
COPY myasset.js /app | |
RUN echo `date` > identifier | |
RUN cat identifier | |
CMD cat identifier |
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 exec = require('child_process').execSync; | |
// I got coordinates using the screenshot picker in quicktime player, | |
// but those are scaled to my screen, not the real video. Do some | |
// corrective fakery | |
const realDimensions = [ 1920, 1080 ]; | |
const fakeWidth = 1680; | |
const fakeTom = [ 1400, 0, 280, 156 ]; | |
const fakeVideo = [ 0, 100, 1470, 760 ]; |
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 content = fs.readFileSync('court-docket.txt', 'utf8').split(/\s*\n\s*/); | |
const data = {}; | |
data.origin = readOrigin(); | |
data.type = readType(); | |
data.docketNumber = readDocketNumber(); | |
data.subtype = readSubtype(); | |
data.case = readCase(); | |
console.log(data); |
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
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); | |
}, |
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
{ | |
"body": [ | |
{ | |
"_index": "testaposdocsdefault", | |
"_type": "aposDoc", | |
"_id": "cjnyogcfp0001n3uktsbndy6m" | |
}, | |
{ | |
"type": "apostrophe-global", | |
"typeESExact": "apostrophe-global", |
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
import ApostropheFieldMixin from '../mixins/ApostropheFieldMixin.js'; | |
export default { | |
mixins: [ ApostropheFieldMixin ], | |
name: 'ApostropheStringField', | |
methods: { | |
validate(value) { | |
if (this.field.required) { | |
if (!value.length) { | |
return 'required'; |
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 = { | |
props: { | |
value: Object, | |
field: Object, | |
context: Object | |
}, | |
data() { | |
return { | |
next: (this.value.data !== undefined) ? this.value.data : (this.field.def || ''), | |
error: false |
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
<template> | |
<ApostropheModal @close="$emit('close')"> | |
<template slot="header"> | |
<p>New {{ options.label }}</p> | |
</template> | |
<template slot="body"> | |
<ApostropheSchemaEditor :fields="options.schema" v-model="pieceInfo" /> | |
</template> | |
<template slot="footer"> | |
<slot name="footer"> |
NewerOlder