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> | |
<ApostropheFieldset :field="field" :error="error"> | |
<template slot="body"> | |
<input v-model="next" /> | |
</template> | |
</ApostropheFieldset> | |
</template> |
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> | |
<fieldset :class="cssClass"> | |
<label class="apos-field-label">{{ field.label }}</label> | |
<div v-if="field.help" class="apos-field-help">{{ field.help }}</div> | |
<slot name="body"></slot> | |
</fieldset> | |
</template> |
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> | |
<div class="apos-schema"> | |
<component | |
v-for="field in fields" | |
:is="options.components.fields[field.type]" | |
v-model="fieldState[field.name]" | |
:field="field" | |
:context="next.data" | |
/> | |
</div> |
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
// This will find "bar" and "woo". But it does not find "foo". | |
(function() { | |
db.dropDatabase(); | |
db.docs.insert([{ | |
title: 'foo', | |
ids: [] | |
}, { | |
title: 'bar' | |
}, { |
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
[ | |
{ | |
name: 'title', | |
label: 'Title' | |
}, | |
{ | |
name: 'updatedAt', | |
label: 'Last Updated', | |
partial: function(value) { | |
if (!value) { |
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
// Demonstration that promises do not involve the pyramid of doom. | |
// Native ES6 promises - you could do it with bluebird promises too, | |
// in which case Promise.delay is a built-in convenience method | |
function delays() { | |
return delay(100).then(function() { | |
return delay(100); | |
}).then(function() { | |
return delay(100); | |
}).then(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
let firstStep = null; | |
if (options.count !== false) { | |
// Create a dummy promise | |
firstStep = Promise.resolve(true); | |
} else { | |
// Do actual work | |
firstStep = q.clone().count(name + '.id')... // etc. | |
} | |
return firstStep.then(... more promises go down ...) | |
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
function getDb() { | |
knox = // ... init stuff, then ... | |
return knox.schema.createTableIfNotExists('users', function (table) { | |
table.bigIncrements(); | |
table.string('username', 15); | |
table.timestamps(); | |
}) | |
.then(function() { | |
knox.schema.createTableIfNotExists('posts', function(table) { | |
table.bigIncrements(); |
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
// test1.js | |
var from = './test2.js'; | |
try { | |
require(from); | |
} catch (e) { | |
console.log(e); | |
} | |
// test2.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
upstream upstream-mysite { | |
server localhost:3000;server localhost:3001; | |
} | |
server { | |
listen *:80; | |
server_name mysite.com; | |
client_max_body_size 32M; | |
access_log /var/log/nginx/mysite.access.log; |