Skip to content

Instantly share code, notes, and snippets.

Marc-Philippe Huget mphuget

View GitHub Profile
View gist:9e892ba828acc02835c98a1216772e63
<!DOCTYPE html>
<title> All Todos </title>
<link rel="stylesheet" href="">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
View Code CRUD MongoDB
function getAllTodos(req, res) {
const Todo = require('../../todo/models');
Todo.find({}, function(err, todos) {
if (err) throw err;
mphuget / gist:209dd8f2e7255e37c50a07c04ed39171
Created Mar 6, 2019 (le ion-content seulement)
View gist:209dd8f2e7255e37c50a07c04ed39171
<ion-content padding>
<form [formGroup]="todo">
<ion-input type="text" formControlName="title"></ion-input>
View gist:b2f9a261c59a695e77376798d9430578
import { Component, OnInit } from '@angular/core';
import { NavController, LoadingController } from '@ionic/angular';
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
import { RestService } from '../rest.service';
import { ActivatedRoute, Router } from '@angular/router';
selector: 'app-add',
templateUrl: './',
styleUrls: ['./'],
View gist:58fb01c7186571ff68016eca80b1c281
import { Component, OnInit } from '@angular/core';
import { LoadingController } from '@ionic/angular';
import { RestService } from '../rest.service';
import { ActivatedRoute, ParamMap } from '@angular/router';
selector: 'app-view',
templateUrl: './',
styleUrls: ['./'],
View gist:41d77dddec55ff8722d95defbc5494bf
import { Component } from '@angular/core';
import { LoadingController, NavController } from '@ionic/angular';
import { RestService } from '../rest.service';
selector: 'app-home',
templateUrl: '',
styleUrls: [''],
View gist:e65a98dabf21b45c64f2554aaf922e09
import { Injectable } from '@angular/core';
import { Observable, of, throwError } from 'rxjs';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { catchError, tap, map } from 'rxjs/operators';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
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">
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 = ""
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;
You can’t perform that action at this time.