Skip to content

Instantly share code, notes, and snippets.

View michaelgira23's full-sized avatar

Michael Gira michaelgira23

View GitHub Profile
@michaelgira23
michaelgira23 / get-emails.js
Last active April 19, 2019 17:06
Veracross Get Student Count
let emails = [];
$('.directory-Entry_FieldLink').each((i, elem) => {
const mailto = $(elem).attr('href');
const parts = mailto.split(':');
if (parts[0] === 'mailto' && parts[1].endsWith('@micds.org')) {
emails.push(parts[1]);
}
});
console.log('[\'', emails.join('\', \''), '\']');
@michaelgira23
michaelgira23 / stringToFromCharCode.js
Last active March 2, 2018 21:42
JavaScript string "obfuscator." CAUTION: *This is only a joke! Do not actually use!*
const string = process.argv.slice(2).join(' ');
let output = '';
string.split('').forEach((value, index) => {
if (index !== 0) {
output += ' + ';
}
output += `String.fromCharCode(${value.charCodeAt(0)})`
});
@michaelgira23
michaelgira23 / input.md
Last active April 1, 2017 05:26
Notes for Webster Programming Competition because I know JavaScript, not Java

Reading and Writing Files in Java

(Copied from http://www.vogella.com/tutorials/JavaIO/article.html)

Overview

Java provides a standard way of reading from and writing to files. Traditionally the java.io package was used, but in modern Java applications you use the java.nio.file API.

Java will read all input as a stream of bytes. The InputStream class is the superclass of all classes representing an input stream of bytes.

Reading a File in Java

To read a text file you can use the Files.readAllBytes method. The usage of this method is demonstrated in the following listing.