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
// HOPED-FOR BEHAVIOR: both /cats.txt AND /cats/cats.txt say: Cats Static | |
// ACTUAL BEHAVIOR: /cats.txt says Cats Static, but /cats/cats.txt says: Main Wildcard | |
var express = require('express'); | |
var fs = require('fs'); | |
var app = express(); | |
// Adding the static middleware at the beginning means it wins out over any routes present | |
// (but only interferes if the file exists) |
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
// HOPED-FOR BEHAVIOR: /cats says: Cats Home | |
// ACTUAL BEHAVIOR: /cats says: Main Wildcard | |
var express = require('express'); | |
var app = express(); | |
app.get('/', function(req, res) { | |
res.send('Main Home'); | |
}) |
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'; |
NewerOlder