Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
Living the JS life

Vladimir de Turckheim vdeturckheim

😇
Living the JS life
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am vdeturckheim on github.
  • I am ecares (https://keybase.io/ecares) on keybase.
  • I have a public key ASCYrvfvzp9hRv0VSx6JA_pAUKwnqVsiHgwUuRi-V-HMvQo

To claim this, I am signing this object:

View test.js
'use strict';
const Code = require('code');
const expect = Code.expect;
const Lab = require('lab');
const lab = module.exports.exports.lab = Lab.script();
const after = lab.after;
const before = lab.before;
const describe = lab.describe;
const it = lab.it;
View app.post.js
app.post('/posts', Celebrate.celebrate(
{
body: Joi.object().keys({
title: Joi.string().required(),
content: Joi.string().required()
})
}
),
(req, res, next) => {
View server.js
'use strict';
const Express = require('express');
const BP = require('body-parser');
const DB = require('./db.js');
const app = Express();
app.use(BP.json());
View db.js
const DB_NAME = 'tests-express-sqlite';
const Fs = require('fs');
const Path = require('path');
const Sqlite = require('sqlite3');
try {
Fs.unlinkSync(`./${DB_NAME}`);
}
catch (_ign) {}
View init.sql
CREATE TABLE POSTS(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
TITLE TEXT NOT NULL,
CONTENT TEXT
);
INSERT INTO POSTS (TITLE, CONTENT)
VALUES ('hello world', 'hello');
INSERT INTO POSTS (TITLE, CONTENT)
View switch-with-over-128-cases-2.js
function exec(arg) {
switch (arg) {
case 1: break;
case 2: break;
...
case 128: break;
case 129: break;
}
}
View switch-with-over-128-cases.js
function exec(arg) {
switch (arg) {
case 1: break;
case 2: break;
case 3: break;
case 4: break;
case 5: break;
case 6: break;
case 7: break;
case 8: break;
View for-in-loop-using-array.js
function exec() {
var arr = [1, 2];
for (var key in arr) {}
}
View with.js
function exec() {
with ({}) {}
}