init
This commit is contained in:
37
.screenrc
Normal file
37
.screenrc
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
startup_message off
|
||||||
|
|
||||||
|
chdir /home/simplonco/Bureau/
|
||||||
|
|
||||||
|
#pour afficher une ligne avec des infos
|
||||||
|
hardstatus on
|
||||||
|
#pour qu'elle s'affiche en bas
|
||||||
|
hardstatus alwayslastline
|
||||||
|
#tout ce qui n'est pas precede de % s'affiche tel quel
|
||||||
|
#tout ce qui est entre {} formate le texte
|
||||||
|
# = format texte inchange
|
||||||
|
# KW couleur arriere bright black, couleur texte bright white
|
||||||
|
# %n numero de windows
|
||||||
|
# %t title de windows
|
||||||
|
# %= remplis les espaces vides
|
||||||
|
# %c current time
|
||||||
|
# %d day
|
||||||
|
# %m month
|
||||||
|
# %y year
|
||||||
|
hardstatus string "%{= KW}%n %t %=%c %D %d-%m-%y"
|
||||||
|
#hide hardstatus: ctrl-a f
|
||||||
|
bind f eval "hardstatus ignore"
|
||||||
|
#show hardstatus: ctrl-a f
|
||||||
|
bind F eval "hardstatus alwayslastline"
|
||||||
|
|
||||||
|
#screen open a new windows
|
||||||
|
# -t assigne un titre
|
||||||
|
# vim appel vim avec l'option -n pour eviter les .swp
|
||||||
|
screen -t shell vim -n $HOME/config/shell.txt
|
||||||
|
screen -t git vim -n $HOME/config/git.txt
|
||||||
|
screen -t screen vim -n $HOME/config/screen.txt
|
||||||
|
screen -t node vim -n $HOME/config/node.txt
|
||||||
|
screen -t react vim -n $HOME/config/react.txt
|
||||||
|
screen -t sites vim -n $HOME/config/sites.txt
|
||||||
|
screen -t vim vim -n $HOME/config/vim.txt
|
||||||
|
|
||||||
|
screen
|
||||||
81
.vimrc
Normal file
81
.vimrc
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
"autocmd BufEnter * let &titlestring = ' ' . expand("%:t")
|
||||||
|
"set title
|
||||||
|
|
||||||
|
"directory indique a vim où mettre les swap files a la place du dossier courrant
|
||||||
|
"le double slash demande a vim de donner au swap file un nom avec son chemin d'acces pour eviter que deux fichiers du meme noms posent un probleme
|
||||||
|
set directory=~/.vim/swapfiles//
|
||||||
|
|
||||||
|
colo torte "utilise la coloration 'torte'
|
||||||
|
set tabstop=2 "regle une tabulation egale a deux espaces
|
||||||
|
set autoindent "indent chaque nouvelle ligne comme la precedente
|
||||||
|
set number "ajout les numeros de ligne
|
||||||
|
"set mouse=a "permet d'utiliser la souris
|
||||||
|
|
||||||
|
"pour mettre en gras ce qui est écrit entre asterisks
|
||||||
|
set concealcursor=n
|
||||||
|
set conceallevel=3
|
||||||
|
"les trois lignes suivantes sont lancees par des auto commands pour declancher leur action malgre que les hilighting groups soient nettoyes par la commande 'hi clear' du fichier $VIMRUNTIME/color/default.vim
|
||||||
|
"autocmd ColorScheme *
|
||||||
|
hi AsteriskBold ctermfg=Green cterm=bold
|
||||||
|
autocmd BufEnter * syn match Asterisks contained "**" conceal
|
||||||
|
autocmd BufEnter * syn match AsteriskBold "\*\*[^*]\+\*\*" contains=Asterisks
|
||||||
|
|
||||||
|
|
||||||
|
"remplis les elements de base d'un fichier html
|
||||||
|
command! Html 0s/^/<!DOCTYPE html>\r<html>\r\t<head>\r\t\t<meta charset="UTF-8">\r\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0">\r\t\t<title><\/title>\r\t\t<link href=".\/style.css" type="text\/css" rel="stylesheet">\r\t\t<script type="text\/javascript" src="script.js" defer><\/script>\r\t<\/head>\r\r\t<body>\r\t<\/body>\r<\/html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"----------------------------------------------------------------
|
||||||
|
"pour transformer un text html et/ou css en sa version affichable
|
||||||
|
"----------------------------------------------------------------
|
||||||
|
"remplace < et > par < et >
|
||||||
|
command! Compare %s/</\</g <bar> %s/>/\>/g
|
||||||
|
"remplir les lignes vides avec des <br>
|
||||||
|
command! Ligne %s/^\n/<br>\r
|
||||||
|
"ajoute <p> et </p> en debut et fin de lignes
|
||||||
|
command! Paragraph %s/^/<p>/g <bar> %s/$/<\/p>/g
|
||||||
|
"remplace les indentations par deux espaces  
|
||||||
|
command! Indenta %s/\t/\ \ \ /g
|
||||||
|
"remplace les < et > autour des commentaires par CS et CE
|
||||||
|
command! Savecomment %s/<!--/CS/g <bar> %s/-->/CE/g
|
||||||
|
"entoure les tag apres < ou </ par <span id="tag"></span>
|
||||||
|
command! Tag %s#<[;/]*\zs[a-z0-9]*\ze#<span id=\"tag\">\0</span>#g
|
||||||
|
"entoure les signes < et > et / et { et } par <span id="sign"></span>
|
||||||
|
command! Sign %s#<\zs/\ze#<span id=\"sign\">\0</span>#g <bar> %s#&[lg]t;#<span id=\"sign\">\0</span>#g <bar> %s#[{}]#<span id=\"sign\">\0</span>#g
|
||||||
|
"entoure les pseudos elements
|
||||||
|
command! Pseudo %s#:\zs[a-z]*\ze.<span id="sign">{#<span id=\"pseudo\">\0</span>#g
|
||||||
|
"entoure les selecteurs css avant les { par <span id="selec"></span>
|
||||||
|
command! Selec %s#<p>\zs[^:{]*\ze.*<span id="sign">{#<span id=\"selec\">\0</span>#g
|
||||||
|
"entoure les actions css avant les : par <span id="action"></span>
|
||||||
|
command! Action %s# \zs[-a-zA-Z0-9]*\ze:#<span id=\"action\">\0</span>#g
|
||||||
|
"entoure toutes les specifications des tags html par <span id="special"><span>
|
||||||
|
command! Special %s#</span>\zs[^>]*\ze<span id="sign">>#<span id=\"special\">\0</span>#g
|
||||||
|
"entoure les commentaires par <span id="comment"></span>
|
||||||
|
command! Comment %s#\(CS\)\(.*\)\(CE\)#<span id=\"comment\">\<!--\2--\></span>#g <bar> %s#/\*.*\*/#<span id=\"comment\">\0</span>#g
|
||||||
|
|
||||||
|
|
||||||
|
function! Editax()
|
||||||
|
Compare
|
||||||
|
Ligne
|
||||||
|
Paragraph
|
||||||
|
Indenta
|
||||||
|
Savecomment
|
||||||
|
Tag
|
||||||
|
Sign
|
||||||
|
Pseudo
|
||||||
|
Selec
|
||||||
|
Action
|
||||||
|
Special
|
||||||
|
Comment
|
||||||
|
Start
|
||||||
|
End
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
"ajoute toutes les lignes du debut
|
||||||
|
command! Start 0s/^/<!DOCTYPE html>\r<html>\r<head>\r<style>\r#cadre {\r position: fixed;\r top: 10vh;\r left: calc(50% - 250px);\r width: 500px;\r max-width: 80vw;\r height: 80vh;\r padding: 10px;\r overflow: hidden;\r border-radius: 10px;\r background-color: rgba(50, 50, 50, 0.9);\r}\r#scroll {\r height: 100%;\r width: calc(100% + 25px);\r box-sizing: border-box;\r padding-right: 10px;\r overflow-y: scroll;\r}\r#scroll p {\r margin: 0;\r padding: 0;\r color: #d3d3d3;\r}\r#tag {\r color: #669999;\r}\r#sign {\r color: white;\r}\r#action {\r color: #cc66cc;\r}\r#selec {\r color: #ff6633;\r}\r#pseudo {\r color: yellow;\r}\r#special {\r color: #8585ad;\r}\r#comment {\r color: #909090;\r}\r<\/style>\r<\/head>\r<body>\r<div id=\"cadre">\r<div id=\"scroll">\r\r<p>\<!DOCTYPE html\><\/p>\r
|
||||||
|
"ajoute toutes les lignes de la fin
|
||||||
|
command! End $s/$/\r\r<\/div>\r<\/div>\r<\/body>\r<\/html>
|
||||||
|
"----------------------------------------------------------------
|
||||||
|
"----------------------------------------------------------------
|
||||||
17
README.txt
Normal file
17
README.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# put this folder "config" into the $HOME directory
|
||||||
|
# and execute the following commands or
|
||||||
|
# just run this README.txt file as an
|
||||||
|
# executable with sh README.txt
|
||||||
|
|
||||||
|
ln -s $HOME/config/.screenrc $HOME/.screenrc
|
||||||
|
ln -s $HOME/config/.vimrc $HOME/.vimrc
|
||||||
|
|
||||||
|
# it will create a symbolic lynk to the
|
||||||
|
# .vimrc and .screenrc files
|
||||||
|
# located in the config folder
|
||||||
|
|
||||||
|
# of course if there already are .vimrc
|
||||||
|
# and .screenrc files in home directory
|
||||||
|
# it will not work, so you need to check
|
||||||
|
# manually what you need to transfer from
|
||||||
|
# these files to the already existing ones
|
||||||
33
git.txt
Normal file
33
git.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
**git init** creates a new git repository"
|
||||||
|
**git status** inspects the contents of the working directory and staging area
|
||||||
|
**git add** adds files from the working directory to the staging area
|
||||||
|
**git add -a** . the -a ensures even file deletions are included
|
||||||
|
**git reset <filename>** to remove a file or files from the staging area
|
||||||
|
**git diff** shows the difference between the working directory and the staging area
|
||||||
|
**git commit** permanently stores file changes from the staging area in the repository
|
||||||
|
**git remote add origin https://github.com/nomutilisateur/monprojet** origin indicate a new place where files will be stored, remote describe origin and indicate that origin is distant, not local but online
|
||||||
|
**git push -u remote_name branch_name** (git push -u origin master) pushes a local branch to a remote, the -u tells git to remember the parameters, so that next time we can simply run git push
|
||||||
|
**git push** pushes the modifications to the distant repository github (remote)
|
||||||
|
**git remote -v** lists all distant origins, remotes, your local git project knows (in other words it lists a git project's remotes)
|
||||||
|
**git remote show origin** show the state of the remote and its branches
|
||||||
|
**git remote rm remote_name** supprimer un remote
|
||||||
|
**git pull** pull any changes from the remote
|
||||||
|
**git clone** creates a local copy of a remote
|
||||||
|
**git branch** lists all a git project's branches
|
||||||
|
**git branch branch_name** creates a new branch
|
||||||
|
**git checkout branch_name** used to switch from one branch to another
|
||||||
|
**git log** shows a list of all previous commits
|
||||||
|
**git log --summary** show more informations
|
||||||
|
**git merge branch_name** join file changes from branch_name into current branch
|
||||||
|
**git branch -d branch_name** deletes the branch specified
|
||||||
|
**git checkout commit_name** detach head from branch into commit, to move in commits
|
||||||
|
**git checkout branch_name^** move head one commit upwards
|
||||||
|
**git checkout branch_name~4** move 4 commits upwards
|
||||||
|
**git checkout HEAD^** if head is not on a branch_name but on a commit
|
||||||
|
**git branch -f master HEAD~3** moves the master branch to 3 parents behind head do not amend a public commit, it will reset the commit the others are working on
|
||||||
|
**git commit --amend** do a commit replacing the last one, even if there was nothing to commit
|
||||||
|
**git commit --amend --no-edit** do a new commit with new things replacing the last one and keepping the last message
|
||||||
|
**git commit --amend -m 'message'** do a new commit that replace the last one with the same content but a new message
|
||||||
|
**git stash** saves the uncommited changes besides for later use
|
||||||
|
**git stash pop** reapply the stashed changes and removes them from the stash area
|
||||||
|
**git stash apply** reaply the stashed changes and keep them in the stash area
|
||||||
54
lexique.txt
Normal file
54
lexique.txt
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
Lexique du développeur
|
||||||
|
Le vocabulaire du petit scarabée :
|
||||||
|
|
||||||
|
un navigateur
|
||||||
|
Site dynamique
|
||||||
|
site statique
|
||||||
|
nom de domaine
|
||||||
|
URL
|
||||||
|
framework
|
||||||
|
SEO
|
||||||
|
un serveur
|
||||||
|
XML
|
||||||
|
algorithme
|
||||||
|
ASCI
|
||||||
|
BackOffice
|
||||||
|
Base de donnée
|
||||||
|
cache
|
||||||
|
cookie
|
||||||
|
FAQ
|
||||||
|
HTTP/HTTP2
|
||||||
|
IMAP
|
||||||
|
ping
|
||||||
|
ROI
|
||||||
|
W3C
|
||||||
|
devOps
|
||||||
|
Stack
|
||||||
|
Pull Request (PR)
|
||||||
|
CI/CD
|
||||||
|
Veille
|
||||||
|
wireframe
|
||||||
|
GIT
|
||||||
|
TERMINAL
|
||||||
|
SSH -
|
||||||
|
NODE.JS
|
||||||
|
ES6
|
||||||
|
HTML5
|
||||||
|
WEBPACK
|
||||||
|
REDUX
|
||||||
|
FRONT/BACK END
|
||||||
|
SOLID
|
||||||
|
KISS
|
||||||
|
YAGNI
|
||||||
|
CRUD
|
||||||
|
REST FULL
|
||||||
|
API
|
||||||
|
JASMINE
|
||||||
|
methode SCRUM
|
||||||
|
methode KANBAN
|
||||||
|
methode KATA
|
||||||
|
methode RANDORI
|
||||||
|
methode TDD
|
||||||
|
methode SPRINT
|
||||||
|
|
||||||
|
|
||||||
265
node.txt
Normal file
265
node.txt
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
**take node_login**
|
||||||
|
[]
|
||||||
|
**npm init -y**
|
||||||
|
[package.json]
|
||||||
|
**npm i express backpack-core mongoose volleyball dotenv babel-preset-stage-3**
|
||||||
|
[node_modules]
|
||||||
|
[package.json]
|
||||||
|
[package-lock.json]
|
||||||
|
**(express)** simplifie le code de node
|
||||||
|
**(backpack)** recharge le serveur en live (npm start)
|
||||||
|
**(babel)** comprend l'es6 (marche avec backpack)
|
||||||
|
**(mongoose)** permet d'uiliser la base de donnée Mongodb
|
||||||
|
**(volleyball)** informe en direct sur ce que tu fais
|
||||||
|
**(dotenv)** cacher les variable environnement
|
||||||
|
|
||||||
|
**----------------------**
|
||||||
|
|
||||||
|
**node_login/package.json**
|
||||||
|
remplacer "test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
par "start": "backpack"
|
||||||
|
|
||||||
|
**node_login**
|
||||||
|
take src
|
||||||
|
touch index.js
|
||||||
|
|
||||||
|
**node_login**
|
||||||
|
npm start //demare backpack et genere build/
|
||||||
|
|
||||||
|
**node_login**
|
||||||
|
touch .env .babelrc
|
||||||
|
|
||||||
|
**node_login/.babelrc**
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"backpack-core/babel",
|
||||||
|
"stage-3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
**node_login**
|
||||||
|
mongod
|
||||||
|
(il va peut-être falloir creer le fichier db dans le dossier data a la racine "sudo mkdir -p /data/db" -p pour creer un fichier dans un dossier et aussi donner tous les droits a db "sudo chmod 777 /data/db")
|
||||||
|
|
||||||
|
**node_login/.env**
|
||||||
|
SERVER_PORT=3000
|
||||||
|
DBUrl = "mongodb://localhost/users_db"
|
||||||
|
|
||||||
|
**node_login/src/index.js**
|
||||||
|
import "dotenv/config";
|
||||||
|
import express from "express";
|
||||||
|
import volleyball from "volleyball";
|
||||||
|
import mongoose from "mongoose";
|
||||||
|
import passport from "passport";
|
||||||
|
import bcrypt from "bcrypt";
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const {SERVER_PORT, DBUrl} = process.env;
|
||||||
|
const url = DBUrl;
|
||||||
|
const options = {promiseLibrary:Promise}
|
||||||
|
|
||||||
|
mongoose.connect(url, options);
|
||||||
|
mongoose.connection.on("connected", () => {
|
||||||
|
console.log("the mongo is working 27017")
|
||||||
|
})
|
||||||
|
|
||||||
|
app.use(express.json());
|
||||||
|
app.use(express.urlencoded({extended:true}));
|
||||||
|
app.use(volleyball);
|
||||||
|
|
||||||
|
app.listen(SERVER_PORT, () => {
|
||||||
|
console.log(`server is listening port... ${SERVER_PORT}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/', (req,res)=>{
|
||||||
|
res.send('life is good with Hajar')
|
||||||
|
})
|
||||||
|
|
||||||
|
**node_login**
|
||||||
|
mkdir public src/models src/routes src/views
|
||||||
|
|
||||||
|
**node_login/src/models/user.js**
|
||||||
|
import mongoose from "mongoose";
|
||||||
|
const Schema = mongoose.Schema;
|
||||||
|
const userSchema = new Schema({
|
||||||
|
name: {type:String, required:true},
|
||||||
|
email: {type:String, required:true},
|
||||||
|
username: {type:String, required:true},
|
||||||
|
password: {type:String, required:true},
|
||||||
|
})
|
||||||
|
|
||||||
|
const User = mongoose.model("User", userSchema);
|
||||||
|
export {User};
|
||||||
|
|
||||||
|
**node_login/src/routes/routes.js**
|
||||||
|
import express from "express";
|
||||||
|
import {User} from "../models/user";
|
||||||
|
|
||||||
|
const userRouter = express.Router();
|
||||||
|
|
||||||
|
userRouter.post("/new_user", (req,res)=>{
|
||||||
|
let newUser = new User(req.body)
|
||||||
|
newUser.save((err,user)=>{
|
||||||
|
if(err) res.send(err)
|
||||||
|
res.json(user)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
export {userRouter};
|
||||||
|
|
||||||
|
**node_login/src/index.js**
|
||||||
|
ajouter :
|
||||||
|
import {userRouter} from "./routes/routes";
|
||||||
|
et
|
||||||
|
app.use("/users", userRouter) //utiliser userRouter pour les url /users
|
||||||
|
|
||||||
|
**node_login/src/views**
|
||||||
|
touch layout.pug user_add.pug
|
||||||
|
|
||||||
|
**node_login/src/views/layout.pug**
|
||||||
|
doctype html
|
||||||
|
html
|
||||||
|
head
|
||||||
|
title
|
||||||
|
link(href="/css/")
|
||||||
|
|
||||||
|
body
|
||||||
|
h1 formulaire
|
||||||
|
block content
|
||||||
|
|
||||||
|
**node_login/src/views/user_add.pug**
|
||||||
|
extends layout
|
||||||
|
block content
|
||||||
|
h2 sign in
|
||||||
|
|
||||||
|
form(action="/users/new_user", method="post")
|
||||||
|
div
|
||||||
|
h5 name
|
||||||
|
input(type="text", name="name", placeholder="enter name")
|
||||||
|
input(type="text", name="email", placeholder="enter email")
|
||||||
|
input(type="text", name="username", placeholder="enter username")
|
||||||
|
input(type="password", name="password", placeholder="enter password")
|
||||||
|
input(type="password", name="confirm", placeholder="confirm password")
|
||||||
|
div
|
||||||
|
h5 validate
|
||||||
|
input(type="submit", value="enter")
|
||||||
|
|
||||||
|
**node_login/src/routes/routes.js**
|
||||||
|
ajouter
|
||||||
|
userRouter.get("/new_user", (req, res)=>{
|
||||||
|
res.render("user_add")
|
||||||
|
})
|
||||||
|
|
||||||
|
**node_login/src/index.js**
|
||||||
|
ajouter
|
||||||
|
import path from "path";
|
||||||
|
et
|
||||||
|
app.use(express.static(path.join(__dirname+"/public")))
|
||||||
|
app.set("views", path.join(__dirname + "/views"))
|
||||||
|
app.set("view engine", "pug")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
**express generator** creer le contenu de base automatiquement
|
||||||
|
**bodyparser** envois les informations d'un formulaire à mongoose
|
||||||
|
|
||||||
|
|
||||||
|
**ngrok https://nrgok.com** pour heberger le site en ligne pendant quelques heures pour le tester
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
**base .env**
|
||||||
|
PORT=3000
|
||||||
|
|
||||||
|
**base src index.js**
|
||||||
|
import express from "express"
|
||||||
|
import "dotenv/config"
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
const { PORT } = process.env
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`ca marche : ${ PORT }`)
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get("/coucou", (req, res) => {
|
||||||
|
res.json("coucou les amis")
|
||||||
|
})
|
||||||
|
|
||||||
|
**base src routes basic.js**
|
||||||
|
import express from "express"
|
||||||
|
|
||||||
|
const basicRouter = express.Router();
|
||||||
|
|
||||||
|
basicRouter.get("/:name", (req, res) => { //jsute un test (:name recupere
|
||||||
|
res.json(`je suis ${req.params.name}`) //des parametres depuis l'url
|
||||||
|
})
|
||||||
|
|
||||||
|
export {basicRouter}
|
||||||
|
|
||||||
|
**--> base src index.js**
|
||||||
|
import { basicRouter } from "./routes/basic"
|
||||||
|
|
||||||
|
app.use("/", basicRouter)
|
||||||
|
|
||||||
|
**base src routes books.js**
|
||||||
|
import express from "express"
|
||||||
|
|
||||||
|
const booksRouter = express.Router();
|
||||||
|
|
||||||
|
booksRouter.get("/add_book", (req, res) => {
|
||||||
|
res.json("ca marche")
|
||||||
|
})
|
||||||
|
|
||||||
|
export {booksRouter}
|
||||||
|
|
||||||
|
**------------------------------**
|
||||||
|
|
||||||
|
**create-react-app nom** creer react dans un dossier "nom"
|
||||||
|
**npm start** lance react
|
||||||
|
**take server**
|
||||||
|
**npm init -y** creer node dans server (server a la racine)
|
||||||
|
**/server npm i express backpack-core mongoose volleyball dotenv babel-preset-stage-3**
|
||||||
|
**vim /server/.babelrc** compilateur es6 pour js
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"backpack-core/babel",
|
||||||
|
"stage-3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
**vim /server/.env**
|
||||||
|
PORT=3001 **(3000 est deja utilise par react)**
|
||||||
|
DBUrl= "mongodb://localhost/blog_db"
|
||||||
|
**take /server/src**
|
||||||
|
**vim /server/src/index.js**
|
||||||
|
import "dotenv/config"
|
||||||
|
import express from "express"
|
||||||
|
const app = express();
|
||||||
|
import mongoose from "mongoose"
|
||||||
|
import volleyball from "volleyball"
|
||||||
|
app.use(volleyball);
|
||||||
|
const { PORT, DBUrl } = process.env;
|
||||||
|
**vim /server/package.json**
|
||||||
|
("test"...) supression
|
||||||
|
"start": "backapck"
|
||||||
|
**npm start** (blog/server/) lance node
|
||||||
|
**vim /server/src/index.js**
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`server is listening port... ${PORT}`)
|
||||||
|
})
|
||||||
|
**vim /server/.env**
|
||||||
|
DBUrl= "mongodb://localhost**:27017**/blog_db"
|
||||||
|
**vim /server/src/index.js**
|
||||||
|
const options = {promiseLibrary:Promise, useNewUrlParser:true}
|
||||||
|
|
||||||
|
mongoose.connect((DBUrl), options)
|
||||||
|
mongoose.connection.on("connected", () => {
|
||||||
|
console.log("the mongo is working 27017")
|
||||||
|
})
|
||||||
|
**mongod** (/server)
|
||||||
3
react.txt
Normal file
3
react.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
**first time** npm install -g create-react-app
|
||||||
|
**otherwise** create-react-app name_folder
|
||||||
|
**then** npm start
|
||||||
28
screen.txt
Normal file
28
screen.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
**screen** sudo apt-get install screen pour avoir plusieurs terminals
|
||||||
|
**ctrl-a |** split vertically
|
||||||
|
**ctrl-a S** split horizontally
|
||||||
|
**ctrl-a Q** unsplit all
|
||||||
|
**ctrl-a X** close current pane
|
||||||
|
**ctrl-a K** kill current pane
|
||||||
|
**ctrl-a \** kill all sessions
|
||||||
|
**ctrl-a d** get out of screen without killing it then run: screen -r to recover session
|
||||||
|
**ctrl-a tab** switch from one splited window to another
|
||||||
|
**ctrl-a n** or **p** move to the next or previous windows
|
||||||
|
**ctrl-a c** start new terminal (in the new window)
|
||||||
|
**ctrl-a space** next terminal
|
||||||
|
**ctrl-a backspace** previous terminal
|
||||||
|
**ctrl-a ctrl a** flip flop between to terminal
|
||||||
|
**ctrl-a "** switch between terminal with a list
|
||||||
|
**,** move windows number down
|
||||||
|
**.** move windows number up
|
||||||
|
**ctrl-a A** rename
|
||||||
|
**ctrl-a l** resize
|
||||||
|
**ctrl-a w** show windows name
|
||||||
|
**ctrl-a esc** go in scroll mode (press esc again to axit)
|
||||||
|
|
||||||
|
to configure actions when launch :
|
||||||
|
**vim ~/.screenrc ** go to or create file screenrc, then write inside:
|
||||||
|
**startup_message off** avoid message at start
|
||||||
|
**chdir -directorie-** change the working directorie
|
||||||
|
**screen -t -name- -action-** start a windows with a name and execute action (for example: screen -t shell vim /Bureau/fiche/chell.txt)
|
||||||
|
**focus** focus on next screen
|
||||||
27
shell.txt
Normal file
27
shell.txt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
**screen size** pour 2*2: 137*38 / pour 1*1: 68*19 (37 et 18 si barre des menus cachee)
|
||||||
|
**ctrl c** termine l'action en cours du terminal
|
||||||
|
**ctrl s** bloque l'affichage du terminal
|
||||||
|
**ctrl q** rétablit la communication avec le terminal
|
||||||
|
**ctrl z** stop le travail en cours et le met sur pause
|
||||||
|
**fg** relance le dernier travail mis sur pause
|
||||||
|
**mkdir file{1..10}** creer 10 dossiers nommés de file1 à file10
|
||||||
|
**pwd** print working directory
|
||||||
|
|
||||||
|
**pdftotext** transforme un pdf en un fichier texte
|
||||||
|
**^** designe le debut d'une ligne
|
||||||
|
* n'importe quel caractere autant de fois que possible
|
||||||
|
**ls** ** montre tous les dossiers et sous-dossiers recursivement
|
||||||
|
**chmod 755 fichier** chmod change les droits des fichiers, organisés en : rwxrwxrwx avec pour valeur r=4 w=2 x=1 donc r-w == r + w == 4 + 1 == 5
|
||||||
|
|
||||||
|
**zsh**
|
||||||
|
**sudo apt-get install zsh**
|
||||||
|
**which zsh** donne le chemin d'acces de zsh (/usr/bin/zsh)
|
||||||
|
**chsh -s /usr/bin/zsh** change shell (chsh) pour zsh
|
||||||
|
(reboot le systeme pour que les changements prennent effet)
|
||||||
|
**echo $SHELL** pour voir quel shell est utilisé
|
||||||
|
(uncomment **line --DISABLE_AUTO_TITLE="true"--** in ~/.zshrc file pour empecher screen de donner un nom automatique aux sessions)
|
||||||
|
|
||||||
|
**sass name.scss name.css** create a css file from a scss file
|
||||||
|
**sass --watch name.scss:name.css** make the transformations of scss in css file
|
||||||
|
**'tree' like :**
|
||||||
|
find | sort | grep -ve "node_modules/" -e ".git/" | sed 's#[^/]*/#|__ #g;s#__ |# |#g;s#| # #g;s#\(node_modules\|.git[ignore]*\)#\1 ...#;$a\ '
|
||||||
33
sites.txt
Normal file
33
sites.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
tools www.preparetocode.io
|
||||||
|
design http://www.dailyui.co/
|
||||||
|
js https://github.com/myjinxin2015/Katas-list-of-Training-JS-series
|
||||||
|
js https://www.javascript.com/
|
||||||
|
js https://github.com/mrdavidlaing/javascript-koans
|
||||||
|
js http://exercism.io/
|
||||||
|
jquery http://try.jquery.com/
|
||||||
|
secu https://www.root-me.org/?/lang=en
|
||||||
|
secu https://www.hackerone.com/ (si tu resouds des bugs tu es payé)
|
||||||
|
secu https://bountyfactory.io/en/index.html (payé pour resoudre des bugs)
|
||||||
|
script https://codecombat.com/
|
||||||
|
script https://screeps.com/
|
||||||
|
script https://repl.it/repls/PuzzlingSugaryWrenchbird
|
||||||
|
script http://gamejam.toxicode.fr/
|
||||||
|
script http://www.toxicode.fr/learn
|
||||||
|
shell https://explainshell.com/
|
||||||
|
shell http://overthewire.org/wargames/bandit/bandit7.html
|
||||||
|
shell https://cmdchallenge.com/
|
||||||
|
git https://try.github.io/levels/1/challenges/1
|
||||||
|
git https://learngitbranching.js.org/?demo
|
||||||
|
git https://github.com/jlord/git-it-electron
|
||||||
|
css https://flukeout.github.io/
|
||||||
|
css http://flexboxfroggy.com/#fr
|
||||||
|
css http://www.flexboxdefense.com/
|
||||||
|
css http://cssgridgarden.com/#fr
|
||||||
|
|
||||||
|
npm init
|
||||||
|
backpack-core
|
||||||
|
express
|
||||||
|
mongoose
|
||||||
|
volleyball
|
||||||
|
babel-preset-stage-3
|
||||||
|
dotenv
|
||||||
122
vim.txt
Normal file
122
vim.txt
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
/MODE INSERTION/
|
||||||
|
**i** mode insertion (écrire du texte)
|
||||||
|
**o** mode insertion a la ligne
|
||||||
|
**3iTEXT** ecrira trois fois TEXT
|
||||||
|
**ctrl r** * colle depuis le clipboard en mode insertion
|
||||||
|
|
||||||
|
/COMMANDES/
|
||||||
|
**:w** enregistrer
|
||||||
|
**:q** quitter
|
||||||
|
**:wq** ou **ZZ** enregister et quitter
|
||||||
|
**:q!** force a quitter
|
||||||
|
**:** mode commande
|
||||||
|
**:%y+** copie toutes les lignes DANS LE CLIPBOARD
|
||||||
|
**:set paste** copier sans les effets des tabulations
|
||||||
|
**: up** affiche les dernieres commandes
|
||||||
|
**:set number** ecrit les numeros de lignes
|
||||||
|
**:set syntax=ON** active la coloration du texte
|
||||||
|
**:set tabstop=4** montre les tabulations (meme existantes) de longueur 4
|
||||||
|
**:set expandtab** en appuyant tab on rentre l'equivalent en espaces
|
||||||
|
**:set expandtab!** enleve le mode tab = espaces
|
||||||
|
**:set autoindent** copie l'indentation de la ligne precedente
|
||||||
|
**:source ~/.vimrc** actualise le fichier vimrc sans redémarrer vim
|
||||||
|
**:sav newname** save as with a new name
|
||||||
|
**:!rm oldname** or **:!rm <ctr r>#** to delete the old copy
|
||||||
|
**:sp** split windows (**<ctr w arrow>** to navigate)
|
||||||
|
**:vsp** split verivally
|
||||||
|
**:sp filename** open a new or already existing filename in split mode
|
||||||
|
**:sp %:h/filename** open new file in the same directory (**%** refers to the current directory, **:h** current directory minus file name and slash)
|
||||||
|
**:colo** active un systeme de coloration a choisir parmis :
|
||||||
|
-- darkblue -- blue -- default -- delek -- desert -- elflord --
|
||||||
|
-- evening -- koehler -- morning -- murphy -- pablo --
|
||||||
|
-- peachpuff -- ron -- shine -- slate -- torte -- zellner --
|
||||||
|
(pour le modifier de manniere permanente :
|
||||||
|
- pour l'utilisateur courant: ouvrir ou creer le fichier ~.vimrc
|
||||||
|
et ajouter dedans: colo "nom du jeu de couleur";
|
||||||
|
- pour tous les utilisateurs: ouvrir le fichier /etc/vim/vimrc
|
||||||
|
et y ajouter: colo "nom du jeu de couleur")
|
||||||
|
|
||||||
|
/MODE VISUEL/
|
||||||
|
**v** mode visuel, selectionne avec le deplacement du curseur
|
||||||
|
**v** **:s/o/n** remplace la premiere occurence par ligne en mode visuelle
|
||||||
|
**v :s/o/n/g** remplace toutes les selections de chaque ligne
|
||||||
|
**v :s/o/n/gc** demande confirmation (y:yes, n:no, a:all remaining, q:quit, l:last)
|
||||||
|
|
||||||
|
/MODE REMPLACEMENT/
|
||||||
|
**R** mode remplacement (esc pour sortir)
|
||||||
|
|
||||||
|
/MODE VISUAL BLOCK/
|
||||||
|
**ctrl v** passe en mode remplacement
|
||||||
|
1-mettre le curseur au debut d'un ligne a commenter
|
||||||
|
2-passer en visual block mode
|
||||||
|
3-avec les fleches descendre jusqu'a la derniere ligne
|
||||||
|
4-appuyer sur shift+i pour passer en mode insertion
|
||||||
|
5-inserer le.s signe.s de commentaire (par exemple: //)
|
||||||
|
6-appuyer sur esc (ttes les lignes vont se commenter)
|
||||||
|
|
||||||
|
/MODE INTERACTIF/
|
||||||
|
**esc** quitte le mode insertion pour rentrer en mode interactif
|
||||||
|
**x** supprime une lettre
|
||||||
|
**r** remplace une lettre (rs remplace la lettre par s)
|
||||||
|
**u** annuler
|
||||||
|
**0** et **$** debut et fin de ligne
|
||||||
|
**gg** et **G** aller a la premiere et derniere ligne
|
||||||
|
**w** avancer le curseur au debut du mot suivant
|
||||||
|
**b** reculer le curseur au debut du mot actuel
|
||||||
|
**e** avancer le curseur a la fin du mot actuel
|
||||||
|
**5G** aller a la ligne 5
|
||||||
|
**g,** va a la position du curseur avant la derniere modification
|
||||||
|
**ctrl r** refaire
|
||||||
|
**ctrl n** auto-completion
|
||||||
|
**dd** coupe une ligne
|
||||||
|
**dw** coupe du curseur a la fin du mot
|
||||||
|
**diw** coupe le "inner" mot
|
||||||
|
**bde** pareil (begining delete end)
|
||||||
|
**bdw** pareil mais en mangeant en plus l'espace en trop avec le mot suivant
|
||||||
|
**d0** coupe du curseur jusqu'au debut de ligne
|
||||||
|
**d$** coupe du curseur jusqu'a la fin de ligne
|
||||||
|
**yy** copie la ligne
|
||||||
|
**p** colle une ligne
|
||||||
|
**.** repete la derniere commande
|
||||||
|
**"ayy** copie la ligne dans le buffer a
|
||||||
|
**"ap** colle la ligne du buffer a
|
||||||
|
**gUU** passe la ligne en uppercase
|
||||||
|
**guu** passe la ligne en lowercase
|
||||||
|
**bgUw** change le mot en uppercase
|
||||||
|
**~** change casse du caractere sous le cursor
|
||||||
|
* va a la prochaine occurence du mot sous le curseur
|
||||||
|
**q:** affiche les dernieres commandes
|
||||||
|
**==** rétablit la bonne indentation pour la ligne
|
||||||
|
**=G** rétablit la bonne indentation pour toute la page
|
||||||
|
|
||||||
|
/REMPLACER/
|
||||||
|
**:s/old/new** remplace la 1ere occurence de ancien par nouveau
|
||||||
|
**:%s/old/new** remplace toutes les occurences
|
||||||
|
**:s/o/n/gi** i veut dire case insensitive
|
||||||
|
**:s/A\zsB\zeC/X** remplace ABC par AXC
|
||||||
|
**:s/A\zs[0-9]** * **\zeC/#\0@** remplace A865C par A#865@C, ou A123C par A#123@C
|
||||||
|
replacement : **/old** va a la premiere prochaine occurence de 'old'
|
||||||
|
**n** va a la prochaine occurence
|
||||||
|
**:s//new** remplace 'old' par 'new'
|
||||||
|
**N** va a la precedente occurence
|
||||||
|
**&** repete la substitution
|
||||||
|
**u** annule la deniere substitution
|
||||||
|
etc...
|
||||||
|
replacement2: **vim old %** va a la toute premiere occurence de 'old'
|
||||||
|
**:s/old/new** remplace 'old' par 'new'
|
||||||
|
**:cn** va a la prochaine occurence
|
||||||
|
**&** repete la substitution
|
||||||
|
**:p** va a la precedente occurence
|
||||||
|
**u** annule la derniere sunstitution
|
||||||
|
etc...
|
||||||
|
|
||||||
|
**command! Name %s//** a écrire dans le fichier ~/.vimrc, créer une fonction
|
||||||
|
**Name** (tjrs avec une majuscule) qui s'execute quand on
|
||||||
|
l'appel. => **:command! Name %s/a/b <bar> %s/A/B** <=> grace à
|
||||||
|
<bar> on peut écrire plusieurs fonctions a la suite
|
||||||
|
**function! Test()** dans ~/.vimrc définit une fonction qui execute plusieurs
|
||||||
|
commandes. Il faut les appeler avec :exec Test(), le ! est
|
||||||
|
tres important pour que la fonction se réecrive a chaque
|
||||||
|
fois, sinon conflit
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user