- Download Atom
- Find in buffer (aka CMD+F or similar)
- toggle
use regex
option - should look like.*
- enter commands below, and leave the replace box blank
options:
(\n\d+\n)
# any amount of numbers wrapped in new lines, should remove page numbers
## practical examples of how to use the Bothan API https://demo.bothan.io/documentation | |
#single values | |
curl -X POST -H "Content-Type: application/json" -d '{"time": "2017-03-12","value": 500}' "https://username:password@demo.bothan.io/metrics/replicate" | |
#multiple values | |
curl -X POST -H "Content-Type: application/json" -d '{"time": "2017-03-12","value": {"total": {"value1": 123,"value2": 213,"value4": 535}}}' "https://username:password@demo.bothan.io/metrics/replicate-multi-val" | |
#value with annual and ytd targets | |
curl -X POST -H "Content-Type: application/json" -d '{"time": "2017-03-12","value": {"actual": 1091000,"annual_target": 2862000,"ytd_target": 1368000}}' "https://username:password@demo.bothan.io/metrics/replcate-ytd-targets" |
var Server = require('./../AnonymousPrototypeModule.js'); | |
console.log("this server is a "+typeof Server); // returns this server is a function | |
console.log(Object.getOwnPropertyNames(Server)); // [ 'length', 'name', 'arguments', 'caller', 'prototype' ] | |
var server = new Server(); | |
console.log("this invoked server is a "+typeof server); // returns this invoked server is a object | |
console.log(Object.getOwnPropertyNames(server)); // returns [] |
use regex
option - should look like .*
options:
(\n\d+\n)
# any amount of numbers wrapped in new lines, should remove page numbers
var r = new Resumable({ | |
// resumable initialised | |
}); | |
$('#standard_files').addClass('hidden'); | |
// Resumable.js isn't supported, fall back on a different method | |
if(!r.support) { | |
console.log("support error"); | |
$('#standard_files').removeClass('hidden'); | |
$('.resumable-error').show(); | |
} else { |
// line 54-86, feature-prebaked | |
// inclusion of printErrs is because type returns as undefined | |
function displayValidationMessages(validation) { | |
console.log(JSON.stringify(validation,null, 2)); | |
var $messagePanel = $('#message-panel'); | |
$messagePanel.html("<h4>Validation results <img src='" + validation.badges.png +"' /></h4>"); | |
var resultsTemplate = _.template('<p><%= validation.errors.length %> errors, <%= validation.warnings.length %> warnings and <%= validation.info.length %> info messages:</p>') | |
$messagePanel.append(resultsTemplate({'validation': validation})); | |
//TODO the errorText function below is truncated and isn't doing what it should be doing | |
var printErrs = validation.errors[0]; |
var hot = new Handsontable(container, { | |
colHeaders: true, | |
- rowHeaders: true, | |
+ rowHeaders: function(index) { | |
+ if (index === 0){ | |
+ return "Header"; | |
+ } else { | |
+ return index; | |
+ } | |
+ }, |
var exportdata = function() { | |
var window = BrowserWindow.getFocusedWindow(); | |
datapackage = new BrowserWindow({width: 450, height: 600, 'always-on-top': true}); | |
datapackage.loadUrl('file://' + __dirname + '/../comma-chameleon/views/datapackage.html'); | |
datapackage.on('closed', function() { | |
datapackage = null; | |
}); |
# ref - http://blog.honeybadger.io/using-lazy-enumerators-to-work-with-large-files-in-ruby/ | |
# The Lazy Enumerator class contains a number of built in collection and mapping methods | |
# e.g. ```map, flat_map, select, reject, grep, zip, take, take_while, drop, drop_while, cycle``` | |
# the basic way that lazy evaluation works with the above methods is like so | |
enum.lazy.select {|variable| (conditional_eval_of_variable) } # returns an array where the eval returns true | |
# in pseudo code fashion I would imagine it would proceed like this | |
CSVlintValidator.select { |validation| output(@ErrorCollector) if !validation.valid? } # returns object or array for the rows which raise messages | |
# validation.valid? could be rewritten in Csvlint::ErrorCollector to be errors.empty? && warnings.empty? | |
# ~ && info_messages.empty? or the output could only happen when an error arises, informing the user that there is already | |
# one error detected and do they wish to continue evaluating in 'lazy' fashion |
if type == :stray_quote && !wrapper.line.match(csv.row_sep) | |
# above evaluates to true && false | |
# however it is false only by placing bang against wrapper.line.match(csv.row_sep) which evals to either | |
# nil or MatchData - seems a strange way to order flow | |
# basically it want's whatever is matched against the row_sep (generated from the CSV.new of data inputted) to not match | |
# because if it matches then bang generates a false and only a stray_quote is logged | |
build_errors(:line_breaks, :structure) | |
# the tests that exist pass \r rather than \r\n when testing for line breaks |
context "error matching tests" do | |
it "checks for blank rows" do | |
# stream = StringIO.new('"","",') # this returns blank_rows | |
# stream = StringIO.new('"","",\r\n"","",\r\n') # this returns :whitespace | |
# stream = StringIO.new('"a",“b“,"c"""') # should return stray quotes but doesn't - there isn't a stray quote test in current code base | |
# stream = StringIO.new("\"a,\"b\",\"c\"\n") # returns unclosed quotes | |
validator = Csvlint::Validator.new(stream,"header" => false) # dialect options to avoid one liners being read as header | |
expect(validator.valid?).to eql(false) |