-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the code used on club night (minor tweaks)
- Loading branch information
0 parents
commit 8fd2ea5
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.swp | ||
*.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# ECC Club Night Tool | ||
This is the program we used to do club night sign-ups for 2017-18. It may or | ||
may not be used in the future but I just wanted to leave it here in case | ||
anyone wants to use it in the future. Written in NodeJS. | ||
|
||
## Dependencies | ||
Use: | ||
```shell | ||
npm install [package] | ||
``` | ||
Packages: | ||
- readline | ||
- fs (usually built-in) | ||
- colors | ||
|
||
## Usage | ||
This tool runs in the console. | ||
```shell | ||
clear | ||
node collect.js [list file] | ||
``` | ||
|
||
## Validation | ||
To make sure nobody trolled you on the signups, validate.js tests for valid | ||
Exeter email addresses, and prints any offending text with the line number | ||
attached. | ||
```shell | ||
node validate.js [list file] | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const readline = require('readline'); | ||
const fs = require('fs'); | ||
const colors = require('colors'); | ||
const opts = { | ||
input: process.stdin, | ||
output: process.stdout, | ||
prompt: 'Exeter Email > '.magenta.bold, | ||
}; | ||
const fname = (process.argv.length > 2) ? process.argv[2] : 'ecc-list.txt'; | ||
|
||
let rl = readline.createInterface(opts); | ||
let motd = []; | ||
motd.push('###########################################'); | ||
motd.push('# #'); | ||
motd.push('# Welcome to Exeter Computing Club 2017 #'); | ||
motd.push('# Check out our GitHub: #'); | ||
motd.push('# https://github.com/exeter #'); | ||
motd.push('# #'); | ||
motd.push('###########################################'); | ||
motd.push(''); | ||
|
||
console.log(motd.join('\n').white.bold); | ||
rl.prompt(); | ||
|
||
rl.on('line', (input) => { | ||
let eml = input.trim().toLowerCase(); | ||
if (eml.indexOf('@') == -1) eml += '@exeter.edu'; | ||
fs.appendFileSync(fname, eml+'\n'); | ||
console.log('Thanks! We\'ll send you an email announcing our first meeting.'); | ||
rl.prompt(); | ||
}); | ||
rl.on('close', function () { | ||
console.log('Bye!'); | ||
}); | ||
rl.on('SIGINT', function () { | ||
rl.clearLine(); | ||
rl.prompt(); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const fs = require('fs'); | ||
const colors = require('colors'); | ||
const fname = (process.argv.length > 2) ? process.argv[2] : 'ecc-list.txt'; | ||
|
||
try { | ||
data = fs.readFileSync(fname, 'utf-8'); | ||
let dlist = data.trimRight().split('\n'); | ||
for (let i = 0; i < dlist.length; i++) { | ||
if (!dlist[i].trim().match(/^([a-z0-9]+)@exeter.edu$/i)) { | ||
console.log( | ||
((i+1) + ': ').red.bold | ||
+ dlist[i].trim() | ||
); | ||
} | ||
} | ||
} catch(e) { | ||
console.error(e.stack); | ||
} |