Skip to content

Instantly share code, notes, and snippets.

View yamikuronue's full-sized avatar

Bay yamikuronue

View GitHub Profile
4|zoidberg | [2016-10-21T13:27:35.386Z] Ping exchanged with 8ms latency
4|zoidberg | [2016-10-21T13:28:00.532Z] Ping exchanged with 145ms latency
4|zoidberg | [2016-10-21T13:28:32.539Z] Ping exchanged with 7007ms latency
4|zoidberg | [2016-10-21T13:28:57.680Z] Ping exchanged with 140ms latency
4|zoidberg | [2016-10-21T13:29:46.904Z] Ping exchanged with 242ms latency
4|zoidberg | [2016-10-21T13:30:11.967Z] Ping exchanged with 59ms latency
4|zoidberg | [2016-10-21T13:30:38.595Z] Ping exchanged with 1627ms latency
4|zoidberg | [2016-10-21T13:31:03.755Z] Ping exchanged with 158ms latency
4|zoidberg | [2016-10-21T13:31:28.877Z] Ping exchanged with 118ms latency
4|zoidberg | [2016-10-21T13:31:54.080Z] Ping exchanged with 196ms latency

Proposed command structure for SockMafia 4.0

Guidelines

  • All commands shall be verbs
  • Direct objects should follow the verb unless that makes an unnatural imparative sentence structure in American English
  • Indirect objects and modifiers shall be signalled by the participles that feel natural in American English
  • Optionally, participles that feel natural in other forms of English can be added as synonyms
  • Indirect objects are order-independant
  • Commands without enough arguments to do anything shall list help

Global modifiers

ensureGameExists: function(id) {
return internals.db.prepare('SELECT id FROM games WHERE id = ?')
.then((statement) => {
return statement.get(id);
})
then((row) => {
if (!row) {
return internals.db.prepare('INSERT INTO games (id, status, current_day, current_stage) VALUES (?, (SELECT id FROM game_statuses WHERE status="active"),0,(SELECT id FROM stages WHERE stage="night"))')
.then((statement) => {
return statement.run(id)
@yamikuronue
yamikuronue / app.js
Created December 19, 2015 20:56
Facebook authentication
app.get('/', function (req, res) {
request('https://graph.facebook.com/v2.5/oauth/access_token?client_id=[redacted]&client_secret=[redacted]&grant_type=client_credentials', function (error, response, body) {
body = JSON.parse(body);
if (!error && response.statusCode == 200) {
res.render('home', {access_token: body.access_token, temp: 'hello world'});
}
})
});
it('should update a board on PUT', (done) => {
dao.addBoard({
ID: '1111',
Name: 'test board',
Adult: false,
BoardMasters: null,
Tags: [],
IC: null
}).then((data) => {
const req = http.request({
host: 'localhost',
port: '8080',
path: '/api/game/1111',
method: 'PUT'
});
req.write(JSON.stringify(formData) + "\n");
req.end();
function getBoard(req, res) {
if (!req.params.id) {
res.status(501).send({error: 'Missing ID'});
return Promise.resolve();
}
return dao.getBoard(req.params.id).then((data) => {
if (Array.isArray(data)) {
data = data[0]; //Only the first board
}
//Set up middleware
const bodyParser = require('body-parser');
let jsonParser = bodyParser.json();
//Attach to route
app.route('/api/boards')
.get(cApi.getAllBoards)
.post(jsonParser, cApi.addBoard)
.patch((_, res) => res.status(405).end())
.delete((_, res) => res.status(405).end())
//The Rules:
[07:22:05 PM] <yamikuronue> T directs everyone to sit on the bleachers; once Dog drags Li back into the room, T moves to the front, clearing her throat. "Right. So. Most of you lot aren't very impressive physically -- there's a few outliers, but typically, your best chance for survival against someone who outclasses you is to hide what you are. For today's lesson, I've asked a friend to lend a hand. I've told him nothing about you; each of you are
[07:22:05 PM] <yamikuronue> going to take a turn having a chat with him. After five minutes, if he guesses your power type reasonably accurately, he gets a point. If he gets it exactly, he gets two points. If he can't guess, the students get a point. If he guesses wrong, students get two points." She wheels over a chalkboard, writing up "Home" and "Away" on the board to keep track. "Understand?"
//The Cast:
//O: Faerie, the guesser
//Gregor: Wizard, the previous victim
//Li: Native-american Coyote Shapeshifter.
getGame: (req, res) => {
if (!req.params.id) {
res.status(501).send({error: 'Missing ID'});
return;
}
return dao.getGame(req.params.id).then((data) => {
if (Array.isArray(data)) {
data = data[0]; //Only the first game
}