Skip to content

Instantly share code, notes, and snippets.

View yvan-sraka's full-sized avatar

Yvan Sraka yvan-sraka

View GitHub Profile
@yvan-sraka
yvan-sraka / norme.py
Last active August 30, 2020 10:21
Python script to check if a C file follow Epitech coding style
#!/usr/bin/python
#
# Made by duponc_j@epitech.net
# Version: 1.2.1
#
'''
An Epitech norme checker
Usage: python norme.py <files to scan> [-nocheat] [-verbose] [-score] [-libc]
@yvan-sraka
yvan-sraka / debug.html
Last active November 6, 2017 17:15
Exercice: debug this bootstrap example page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
@yvan-sraka
yvan-sraka / array.php
Last active November 6, 2017 17:14
How to open a JSON file in PHP
<?php
/*
* Open example.json file,
* parse it into a $json array
*/
$string = file_get_contents("example.json", FILE_USE_INCLUDE_PATH);
$json = json_decode($string, true);
@yvan-sraka
yvan-sraka / pokemon.php
Last active November 6, 2017 17:16
Pokemon class example in PHP
<?php
// version 1 of class Pokemon
class Pokemon {
public $name;
public $level;
public $pv;
public function attack($name) {
@yvan-sraka
yvan-sraka / return_vs_echo.php
Last active November 6, 2017 17:22
Show difference between return and echo keyword in PHP
<?php
$name = "Bob";
echo $name;
// VS //
echo "Bob";
// ---------------------------- //
@yvan-sraka
yvan-sraka / sql_query_example.php
Last active November 6, 2017 17:23
Example of a SQL query in PHP
<?php
// Connexion à la base de données
try {
$bdd = new PDO('mysql:host=localhost;dbname=mysql;charset=utf8', 'root', 'simplonco');
} catch(Exception $e) {
die('Erreur : '.$e->getMessage());
}
// Execution d'une requête SQL
$reponse = $bdd->query('SHOW DATABASES;');
<?php phpinfo(); ?>
@yvan-sraka
yvan-sraka / example.json
Last active November 6, 2017 17:24
Example of a JSON file structuring books data
{
"books": {
"programming": [{
"name": "Apprendre à coder en PHP",
"price": 26.00,
"author": "Matthieu Nebra"
}, {
"name": "Learn you a Haskell",
"price": 0.00,
"author": "Miron Lipovaca"
@yvan-sraka
yvan-sraka / example.xml
Last active November 6, 2017 17:24
Example of a XML file structuring books data
<books>
<programming>
<book>
<name>Apprendre à coder en PHP</name>
<price>26.00</price>
<author>Matthieu Nebra</author>
</book>
<book>
<name>Learn you a Haskell</name>
<price>0.00</price>
<a href="mailto:yvan@simplon.co">Contact me</a>