Skip to content

Instantly share code, notes, and snippets.

let http = require('http');
let url = require('url');
let port = 3000;
let server = http.createServer((request, response) => {
var page = url.parse(request.url).pathname;
console.log(page);
response.writeHead(200, {
'Content-Type': 'text/plain'
const mongoose = require('mongoose');
const express = require('express');
const faker = require('faker');
var app = express();
var userSchema = new mongoose.Schema({
email: {
type: String,
required: true,
@gaspaonrocks
gaspaonrocks / correction_gist.js
Created August 16, 2017 09:09
test SportHeroesGroup
function fixGpsTrack(gpsTrack) {
// Make sure trackpoints are chronologically sorted by date
// il n'y a pas besoin de réaffecter gpsTrack.
gpsTrack.sort(function (trackpointA, trackpointB) {
return trackpointB.timestamp - trackpointA.timestamp;
});
// Remove incomplete trackpoints
gpsTrack.filter(function (trackpoint) {
return trackpoint.lat && trackpoint.lon && trackpoint.timestamp;
@gaspaonrocks
gaspaonrocks / cloudSettings
Last active April 23, 2018 09:11 — forked from caedes/cloudSettings
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-23T09:11:43.377Z","extensionVersion":"v2.9.0"}
@gaspaonrocks
gaspaonrocks / example-test.js
Last active July 21, 2018 11:38
using mock-fs with jest to assert the result of file system operations in a sync manner
import mock from 'mock-fs';
import fs from 'fs';
import fileHandler from '../utils/fileHandler';
beforeEach(() => {
// Creates an in-memory file system
mock({
'/test': {
'note.md': 'hello world!'
}
const { hasOwnProperty } = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
@gaspaonrocks
gaspaonrocks / introrx.md
Created January 29, 2019 10:25 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing