Skip to content

Instantly share code, notes, and snippets.

Marc-Philippe Huget mphuget

View GitHub Profile
View gist:3a1c6daded9d686464cd7dc1d794f615
<!DOCTYPE html>
<html>
<head>
<title> ACME Company </title>
</head>
<body>
<!--header-->
<div>
</div>
@mphuget
mphuget / gist:18c07987d56f6b3d6f9db9f372aee595
Created Mar 7, 2018
socnet/signup/controllers/index.js
View gist:18c07987d56f6b3d6f9db9f372aee595
function signup(req, res) {
res.render('signup');
}
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
mphuget / gist:1aa25850adb5fccd4ba631cb34f91efc
Created Mar 7, 2018
socnet/signup/views/pages/signup.ejs
View gist:1aa25850adb5fccd4ba631cb34f91efc
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function check(str) {
if (str.length == 0) {
document.getElementById("taken").innerHTML = "";
return;
} 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
<head>
<title> Sign up </title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//code.jquery.com/jquery-1.11.1.min.js"></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
mphuget / gist:73c1da91afe9a6de80e5b5162ed38962
Created Dec 14, 2018
JavaScript + validation formulaire
View gist:73c1da91afe9a6de80e5b5162ed38962
<!DOCTYPE html>
<html>
<head>
<title> Mon formulaire </title>
<script>
function validateEntries() {
nom = document.getElementById("nom").value;
prenom = document.getElementById("prenom").value;
email = document.getElementById("email").value;
@mphuget
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-list>
<ion-item-sliding #item>
<ion-item>
A new todo
</ion-item>
<ion-item-options side="start">
<button ion-button color="light" routerLink="/">Done</button>
</ion-item-options>
<ion-item-options side="end">
You can’t perform that action at this time.