Skip to content

Instantly share code, notes, and snippets.

View quentinchap's full-sized avatar

CHAPELLE Quentin quentinchap

View GitHub Profile
@quentinchap
quentinchap / index.html
Created November 11, 2016 12:09
Round button
<html ng-app="testController">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js" type="text/javascript"></script>
<script src="http://m-e-conroy.github.io/angular-dialog-service/javascripts/dialogs.min.js" type="text/javascript"></script>
<link href="https://fonts.googleapis.com/css?family=PT+Sans+Narrow" rel="stylesheet">
</head>
<body ng-controller="animeCtrl as ctrl">
@quentinchap
quentinchap / index.html
Created November 11, 2016 21:25
SimpleAnims
<div>
<svg width="150" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<text x="0" y="10"
font-family="Verdana"
font-size="10">
<tspan x="0" dy="1.2em" font-weight="bold">Animation 1<tspan>
<tspan x="0" dy="1.2em" font-weight="normal">Translation simple<tspan>
</text>
<g>
@quentinchap
quentinchap / app-extract1.js
Last active October 20, 2017 12:40
Gist dans le cadre d'un article sur https://devotics.fr
// Chargement de la bibliothèque express
var express = require('express');
var app = express();
/* Création d'une route. Chaque route correspondra à un URL différent.
Ici cela correspond à http://mon_adresse/
Si nous avions app.get('/name', function (req, res) {
La route serait http://mon_adresse/name
*/
app.get('/', function (req, res) {
@quentinchap
quentinchap / init-project.sh
Last active October 12, 2017 07:45
Gist dans le cadre d'un article sur https://devotics.fr
mkdir mon_app # Création d'un dossier qui contiendra votre code
cd mon_app
npm init # Initialisation du projet
npm install express --save # Installation de votre première bibliothèque
@quentinchap
quentinchap / launch-app.sh
Last active October 12, 2017 07:45
Gist dans le cadre d'un article sur https://devotics.fr
node app.js
@quentinchap
quentinchap / app-extract2.js
Last active October 12, 2017 07:45
Gist dans le cadre d'un article sur https://devotics.fr
// Création de la route /hello
app.get('/hello', function(req, res) {
// Récupération du paramètre "name"
var name = req.param('name');
// Création et envoi de la réponse
res.send('GET: Hello ' + name);
});
@quentinchap
quentinchap / install-body-parser.sh
Last active October 12, 2017 07:45
Gist dans le cadre d'un article sur https://devotics.fr
npm install --save body-parser
@quentinchap
quentinchap / app-extract3.js
Created October 12, 2017 07:51
Gist dans le cadre d'un article sur https://devotics.fr
// Chargement de la bibliothèque body parser
var bodyParser = require('body-parser')
app.use(bodyParser.json());
// Création d'une route post
app.post('/name', function(req, res) {
//Récupération de la propriété name dans le body
var name = req.body.name;
res.send('POST: hello ' + name);
});
npm install request --save
@quentinchap
quentinchap / app-extract4.js
Last active October 20, 2017 12:41
Gist dans le cadre d'un article sur https://devotics.fr
// Chargement de la requête
var request = require('request');
// Création d'une nouvelle route GET
app.get('/wikipedia', function(req, res) {
// Envoi d'une requête vers une api (GET)
request.get({
url: "https://en.wikipedia.org/api/rest_v1/page/"
}, function(error, response, body) {