Skip to content

Instantly share code, notes, and snippets.

Marc-Philippe Huget mphuget

View GitHub Profile
View gist:3a1c6daded9d686464cd7dc1d794f615
<!DOCTYPE html>
<title> ACME Company </title>
mphuget / gist:18c07987d56f6b3d6f9db9f372aee595
Created Mar 7, 2018
View gist:18c07987d56f6b3d6f9db9f372aee595
function signup(req, res) {
function signupProcess(req, res) {
//we create a new User to be saved into the database
var User = require('../../user/models/user');
var user = new User();
var utilities = require('../../core/utilities');
View gist:33ff6624174affda99c907225640395f
let router = require('express').Router();
let controller = require('../controllers');
router.get('/signup', (req, res) => {
controller.signup(req, res);
mphuget / gist:1aa25850adb5fccd4ba631cb34f91efc
Created Mar 7, 2018
View gist:1aa25850adb5fccd4ba631cb34f91efc
<!DOCTYPE html>
<html lang="en">
function check(str) {
if (str.length == 0) {
document.getElementById("taken").innerHTML = "";
} else {
var xmlhttp = new XMLHttpRequest();
View gist:2b49dec142321bc2113b2aa2904cdd32
let mongoose = require('mongoose');
let bcrypt = require('bcrypt-nodejs');
// define the schema for our user model
let Schema = mongoose.Schema;
let UserSchema = new Schema({
local : {
firstName: String,
View gist:4cd51f4a3f4b166d8757c2ced903df19
<title> Sign up </title>
<link href="//" rel="stylesheet" id="bootstrap-css">
<script src="//"></script>
<link rel="stylesheet" href="/css/signup.css">
<script type="text/javascript">
function validate_form() {
let username = document.getElementById('username').value;
View snake.js
$(document).ready(function() {
var canvas = $("#myCanvas")[0];
var ctx = canvas.getContext("2d");
var w = $("#myCanvas").width();
var h = $("#myCanvas").height();
var cw = 15;
var food;
var snake;
var d = "RIGHT";
mphuget / gist:73c1da91afe9a6de80e5b5162ed38962
Created Dec 14, 2018
JavaScript + validation formulaire
View gist:73c1da91afe9a6de80e5b5162ed38962
<!DOCTYPE html>
<title> Mon formulaire </title>
function validateEntries() {
nom = document.getElementById("nom").value;
prenom = document.getElementById("prenom").value;
email = document.getElementById("email").value;
mphuget / gist:b3e8e667c9b815e1f089635e1ee8ce34
Created Feb 8, 2019
Accessing Twitter streaming 1% sample in Python
View gist:b3e8e667c9b815e1f089635e1ee8ce34
#Import the necessary methods from tweepy library
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
#Variables that contains the user credentials to access Twitter API
access_token = ""
access_token_secret = ""
consumer_key = ""
consumer_secret = ""
View gist:68d687a1e8851e63aef97ea59eddc380
<ion-content padding>
<ion-item-sliding #item>
A new todo
<ion-item-options side="start">
<button ion-button color="light" routerLink="/">Done</button>
<ion-item-options side="end">
You can’t perform that action at this time.