Skip to content

Instantly share code, notes, and snippets.

View yvan-sraka's full-sized avatar

Yvan Sraka yvan-sraka

View GitHub Profile
#include <iostream>
#include <string>
int main(void) {
std::string test = "j'adore les cookies au chocolat";
for (int i = 0; i < test.size(); ++i) {
test[i] = test[i] - 10;
}
std::cout << test << std::endl;
}
<?php
namespace Tests\AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
This file has been truncated, but you can view the full file.
a
à
abaissa
abaissable
abaissables
abaissai
abaissaient
abaissais
abaissait
abaissâmes
<?php
$a .= "a";
$a .= "b";
$a .= "c";
// What is the value of `$a` ?
echo "Answer: ".$a."\n";
// => Answer: abc
{
"books": {
"programming": [{
"name": "Apprendre à coder en PHP",
"price": 26.00,
"author": "Matthieu Nebra"
}, {
"name": "Learn you a Haskell",
"price": 0.00,
"author": "Miron Lipovaca"
<?hh
// Exercice 1
$string = file_get_contents("dictionnaire.txt", FILE_USE_INCLUDE_PATH);
$dico = explode("\n", $string);
// How many words this dictionary contains?
echo count($dico); // answer: 336532
Exercice 2:
<?php
$string = file_get_contents("films.json", FILE_USE_INCLUDE_PATH);
$brut = json_decode($string, true);
$top = $brut["feed"]["entry"]; # list of films
?>
What is the ranking of the movie “Gravity”?
<?php
$i = 0;
<?hh
// Exercice 1
$string = file_get_contents("dictionnaire.txt", FILE_USE_INCLUDE_PATH);
$dico = explode("\n", $string);
// How many words this dictionary contains?
echo count($dico) . "<br/>"; // answer: 336532
{"feed":{"author":{"name":{"label":"iTunes Store"}, "uri":{"label":"http://www.apple.com/itunes/"}}, "entry":[
{"im:name":{"label":"The Martian"}, "im:image":[
{"label":"http://is2.mzstatic.com/image/thumb/Video49/v4/27/97/1b/27971b4f-1d05-812b-a09f-0d51b9c7b264/pr_source.lsr/60x60bb-85.jpg", "attributes":{"height":"60"}},
{"label":"http://is2.mzstatic.com/image/thumb/Video49/v4/27/97/1b/27971b4f-1d05-812b-a09f-0d51b9c7b264/pr_source.lsr/60x60bb-85.jpg", "attributes":{"height":"60"}},
{"label":"http://is4.mzstatic.com/image/thumb/Video49/v4/27/97/1b/27971b4f-1d05-812b-a09f-0d51b9c7b264/pr_source.lsr/170x170bb-85.jpg", "attributes":{"height":"170"}}], "summary":{"label":"From legendary director Ridley Scott (Alien, Prometheus) comes a gripping tale of human strength and the will to survive. During a mission to Mars, American astronaut Mark Watney (Matt Damon) is presumed dead and left behind. But Watney is still alive. Against all odds, he must find a way to contact Earth in the hope that scientists can devi
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8"/>
<title>PHP Form Example</title>
</head>
<body>
<form action="index.php" method="POST">
<input name="name" type="text" />
<input name="password" type="password" />