Skip to content

Instantly share code, notes, and snippets.

🔬
Experimenting

John Beech johnbeech

🔬
Experimenting
Block or report user

Report or block johnbeech

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 Factorio Releases
0.17.23|Fri Mar 29, 2019 4:57 pm
0.17.22|Fri Mar 29, 2019 12:44 pm
0.17.21|Tue Mar 26, 2019 8:46 pm
0.17.20|Tue Mar 26, 2019 4:49 pm
0.17.19|Tue Mar 26, 2019 2:55 pm
0.17.18|Mon Mar 25, 2019 6:24 pm
0.17.17|Thu Mar 21, 2019 7:49 pm
0.17.16|Tue Mar 19, 2019 9:50 pm
0.17.15|Mon Mar 18, 2019 8:33 pm
0.17.14|Fri Mar 15, 2019 8:20 pm
@johnbeech
johnbeech / Console Output
Created Jan 14, 2019
ftp-deploy 501 Error: Invalid number of arguments - remoteRoot: '/' not working (works ok if I changed roots to /site
View Console Output
>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)
@johnbeech
johnbeech / chart-options.config.js
Last active Nov 23, 2018
Example CFD config X and Y axis labels
View chart-options.config.js
const chartOptions = {
maintainAspectRatio: false,
spanGaps: false,
elements: {
line: {
tension: 0.4,
backgroundColor: 'rgba(0,0,0,0.1)'
},
point: {
radius: 0,
@johnbeech
johnbeech / parse-url-params.js
Created Nov 20, 2018
Parse parameters from URL
View parse-url-params.js
// 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];
@johnbeech
johnbeech / split.js
Last active Aug 12, 2017
Splits a large list of corporation fittings into a separate smaller XML files
View split.js
/* 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')
@johnbeech
johnbeech / moveTo.js
Created Apr 8, 2017
Function to move items between arrays
View moveTo.js
function move(a) {
function to(b) {
while (a.length > 0) {
let item = a.shift()
b.push(item)
}
}
return {
to
}
@johnbeech
johnbeech / cookie.js
Last active Mar 13, 2017
Interface to read, write, and clear browser cookies
View cookie.js
@johnbeech
johnbeech / server.js
Created Jul 22, 2016
Experiment in testing /'s on routes
View server.js
/*
* Express server - Testing /'s on routes
* npm i express
* node server.js
*/
const express = require('express');
const app = express();
@johnbeech
johnbeech / poll-status-endpoint.js
Last active Aug 29, 2015
Test if a status endpoint is working by polling it every 10 seconds for 2 minutes.
View poll-status-endpoint.js
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) {
@johnbeech
johnbeech / configService-callbacks.js
Created Jul 3, 2015
Harness for comparing and contrasting Class Based API or Callback Function API
View configService-callbacks.js
// 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') {
You can’t perform that action at this time.