Skip to content

Instantly share code, notes, and snippets.

import * as d3 from "d3";
const MARGIN = { TOP: 10, BOTTOM: 60, LEFT: 100, RIGHT: 10 };
const WIDTH = 600 - MARGIN.LEFT - MARGIN.RIGHT;
const HEIGHT = 400 - MARGIN.TOP - MARGIN.BOTTOM;
let flag = true;
class Coffee {
constructor(element, data) {
<?php
var_dump($_POST);
?>
<form action="thanks.php" method="post">
<div>
<label for="nom">Nom :</label>
<input type="text" id="nom" name="user_name">
</div>
<div>
<?php
$characters = [
"Negan" => [
"city" => "The Sanctuary",
"weapon" => "Lucille"
],
"Daryl" => [
"city" => "Alexandria",
"weapon" => "crossbow"
<?php
function writeSecretSentence (string $first, string $second) {
if (is_string($first) && is_string($second)){
$message=$first . " s'incline devant " . $second;
return $message;
}else{
$message="error";
return $message;
}
<?php
$weapons = ['fists', 'whip', 'gun'];
$opponentWeapon = $weapons[rand(0,2)];
switch ($opponentWeapon) {
case 'fists':
$indyWeapon = 'gun';
break;
case 'whip':
<?php
$indiMovies = [
'indiana jones and the last crusade' => ['Harrisson Ford', 'Sean Connery', 'Alison Doody'],
'indiana jones and the temple of doom' => ['Harrisson Ford', 'Kate Capshaw', 'Jonathan ke quan' ],
'indiana jones and the kingdom of the crystall skull' => ['Harrisson Ford', 'Shia Leboeuf', 'Karen allen' ],
];
foreach ($indiMovies as $key => $title) {
echo $key;
<?php
$indiMovies = [
'indiana jones and the last crusade' => '1989',
'indiana jones and the temple of doom' => '1984',
'indiana jones and the kingdom of the crystall skull' => '2008',
];
asort($indiMovies);
import java.util.Arrays;
class Movies {
public static void main(String[] args) {
String[] movies = { "les aventuriers de l'arche perdus", "le temple maudit", "la dernière croisade" };
String[][] actors = new String[][] { { "Harrison Ford", "Kareen Allen", "Paul Freeman" },
{ "Harrison Ford", "Kate Capshaw", "Jonathan ke quan" },
class Indy {
public static void main(String[] args) {
String movieName = "Indiana Jones and the Last Crusade";
boolean saw = true;
int releasedDate = 1989;
float rated = 8.2f;
System.out.println(movieName);
System.out.println(releasedDate);
class candyCount {
public static void main(String args[]) {
double money = 12.4;
double price = 1.2;
double candies = 0;
if (money > 0 && price > 0) {
while (money - price >= 0) {
candies++;
money = money - price;