Skip to content

Instantly share code, notes, and snippets.

View joshuakfarrar's full-sized avatar
💻
EitherT[IO, Throwable, Human]

Joshua K. Farrar joshuakfarrar

💻
EitherT[IO, Throwable, Human]
View GitHub Profile
"use strict";
var fs = require('fs');
console.log(fs.readFileSync(process.argv[2]).toString().split('\n').length - 1);
console.log(new Buffer("bytewiser"));
// the instructions for this problem suck. fix https://github.com/nodeschool/discussions/issues/245
var bytes = [0, 15, 24, 3, 250, 83];
console.log(new Buffer(bytes).toString('hex'));
// had to use http://www.asciitable.com/ .. values should be in instructions, resource should be presented for next problem.
"use strict";
var bl = require('bl');
process.stdin.pipe(bl(function(err, data) {
for (var k = 0; k < data.length; k++) {
if (data[k] == 0x2e) data[k] = 0x21;
}
console.log(data);
// "Extra bonus points if you avoid using fs.readFileSync" doesn't add value. Of course we should do it async
"use strict";
var fs = require('fs')
, bt = require('buffertools');
fs.readFile(process.argv[2], function(err, data) {
var offset = 0;
while (true) {
var nl = bt.indexOf(data, '\n', offset);
var buffers = [];
process.stdin.on('readable', function(chunk) {
var chunk = process.stdin.read();
if (chunk !== null) {
buffers.push(chunk);
}
});
process.stdin.on('end', function() {
royalflush:bytewiser sent1nel$ node bytewiser.js run ~/node/bytewiser/1.js
TypeError: Cannot read property 'stderr' of undefined
at Exercise.processor (/Users/sent1nel/bytewiser/node_modules/workshopper-exercise/comparestdout.js:36:23)
at next (/Users/sent1nel/bytewiser/node_modules/workshopper-exercise/exercise.js:152:19)
at Exercise.process (/Users/sent1nel/bytewiser/node_modules/workshopper-exercise/exercise.js:161:5)
at Exercise.<anonymous> (/Users/sent1nel/bytewiser/node_modules/workshopper-exercise/exercise.js:125:10)
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
royalflush:bytewiser sent1nel$ node bytewiser.js current
Array Buffers
royalflush:bytewiser sent1nel$ node bytewiser.js run exercises/array_buffers/solution/solution.js
{"0":24557,"1":132,"BYTES_PER_ELEMENT":2,"buffer":{"0":237,"1":95,"2":132,"3":0,"byteLength":4},"length":2,"byteOffset":0,"byteLength":4}
royalflush:bytewiser sent1nel$ node bytewiser.js verify exercises/array_buffers/solution/solution.js
Your submission results compared to the expected:
angular.module('app')
.filter('reverse', function() {
return function(items) {
return items.slice().reverse();
};
});
def upload
spreadsheet = Roo::CSV.new(params[:file].path, csv_options: {col_sep: "\t"})
spreadsheet.inspect
header = spreadsheet.row(1)
(2..spreadsheet.last_row).each do |i|
row = Hash[[header, spreadsheet.row(i)].transpose]
end
redirect_to root_url
end