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
>node deploy stage-all | |
[Deploy] stage-all : { include: [ 'site/**/*' ] } | |
[Deploy] Connected to: ftp.mkv25.net | |
[Deploy] Connected: Server message: 192.252.146.30 FTP server ready | |
[Deploy] Error: { Error: Invalid number of arguments | |
at makeError (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:1128:13) | |
at Parser.<anonymous> (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:122:25) | |
at Parser.emit (events.js:182:13) | |
at Parser._write (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\parser.js:61:10) | |
at doWrite (_stream_writable.js:410:12) |
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 chartOptions = { | |
maintainAspectRatio: false, | |
spanGaps: false, | |
elements: { | |
line: { | |
tension: 0.4, | |
backgroundColor: 'rgba(0,0,0,0.1)' | |
}, | |
point: { | |
radius: 0, |
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
// collapsed onto one line | |
const getParams(href) => (href.split('?')[1] || '').split('&').map(kvp => kvp.split('=')).reduce((acc, kvp) => { acc[kvp[0]] = kvp[1]; return acc }, {}) | |
// spread out into a traditional function | |
function getParams(href) { | |
return (href.split('?')[1] || '') | |
.split('&') | |
.map(kvp => kvp.split('=')) | |
.reduce((acc, kvp) => { | |
acc[kvp[0]] = kvp[1]; |
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
/* Use node 4.5, npm i cheerio, then run: node split.js */ | |
var cheerio = require('cheerio') | |
var fs = require('fs') | |
var contents = fs.readFileSync(__dirname + '/CORP-FITTINGS.xml') | |
var $ = cheerio.load(contents, { | |
normalizeWhitespace: true, | |
xmlMode: true | |
}) | |
var $fittings = $('fitting') |
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 move(a) { | |
function to(b) { | |
while (a.length > 0) { | |
let item = a.shift() | |
b.push(item) | |
} | |
} | |
return { | |
to | |
} |
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
/* | |
* Express server - Testing /'s on routes | |
* npm i express | |
* node server.js | |
*/ | |
const express = require('express'); | |
const app = express(); |
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
var request = require('request'); | |
var assert = require('assert'); | |
var testUrl = process.argv[2] || 'No url set'; | |
var expectedStatusBody = 'Status 200 OK'; | |
// Try for 2 minutes, every 10 seconds, to see if server has booted up | |
runTest(12); | |
function runTest(attempts) { |
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
// Config Service using callback | |
var Service = function(query, readyCallback, errorCallback) { | |
var arc = "arc data"; | |
if(query.indexOf("bad") > -1) { | |
if(typeof errorCallback === 'function') { | |
errorCallback("bad contents"); | |
} | |
} | |
else { | |
if(typeof readyCallback === '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
module.exports = require('./default-config'); | |
module.exports.environment = 'test'; | |
module.exports.configService = function(query) { | |
var deferred = {}; | |
deferred.then = function(callback) { | |
deferred.resolve = callback; | |
return this; |
NewerOlder