Instantly share code, notes, and snippets.

View getMiddle.js
You are going to be given a word. Your job is to return the middle character of the word.
If the word's length is odd, return the middle character.
If the word's length is even, return the middle 2 characters.
String.prototype.toJadenCase = function () {
return this.split(' ').map(function (item) {
return item.replace(item.charAt(0), item.charAt(0).toUpperCase());
}).join(' ');
};
View promise.js
class Monstre {
constructor (options = {}){
this.health = 100;
this.name = options.name;
}
heal() {
this.health= this.health + 10;
return this.health;
View ES6.js
const address = {
city: "Lyon",
state: "FR",
zip: 69001
};
const sportList = ['Football', 'BasketBall']
const otherSportList = ['Boxe', 'Judo']
sportList.push(...otherSportList)
View MyTimer.js
import React, {Component} from 'react';
class MyTimer extends React.Component {
constructor (props) {
super(props)
this.state = {count: 1}
}
componentDidMount () {
this.startTimer(this.timer)
}
View app.js
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import logo from './logo.svg';
import './App.css';
import Author from './test';
import Password from './password';
class App extends Component {
render() {
View app.js
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import logo from './logo.svg';
import './App.css';
import Author from './test';
class App extends Component {
render() {
return (
<div className="App">
View upload.js
var express = require('express');
var router = express.Router();
var multer = require('multer');
var upload = multer({
dest: 'tmp/'
});
var fs = require('fs');
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', {
View Delete.js
var express = require('express');
var router = express.Router();
//PUT
router.get('/:nom((\[a-z]+))', function (req, res, next) {
res.render('update-user', {
id: req.params.nom
});
});
View mail.js
var express = require('express');
var router = express.Router();
var cookieParser = require('cookie-parser');
var session = require('express-session');
var app = express();
const nodemailer = require("nodemailer");
var smtpTransport = require('nodemailer-smtp-transport');
var transport = nodemailer.createTransport(smtpTransport({
service: 'gmail',
View node.js
var express = require('express');
var router = express.Router();
var cookieParser = require('cookie-parser');
var session = require('express-session');
var app = express();
/* GET home page. */
router.get('/', function (req, res) {
res.render('index', {