Skip to content

Instantly share code, notes, and snippets.

@Keirua
Keirua / alert.js
Last active December 11, 2016 11:24
alert("plop");
@Keirua
Keirua / use-array_key_exists.php
Created December 13, 2016 07:53
Utilisez array_key_exists !
<?php
$a = ['AB' => 12, 'CB' => 34];
echo "Cas nominal : La clé est présente dans le tableau".PHP_EOL;
echo (int)array_key_exists('AB', $a).PHP_EOL;
echo (int)isset($a['AB']).PHP_EOL;
echo (int)!empty($a['AB']).PHP_EOL;
echo "Cas nominal : La clé n'est pas présente dans le tableau".PHP_EOL;
@Keirua
Keirua / fib_log.py
Created April 13, 2020 21:58
fibonacci with O(log(n)) complexity
#
from decimal import *
def fib(n):
return fib_iter(1,0,0,1,Decimal(n))
def fib_iter(a,b,p,q,n):
nb_iter = 0
while n != 0: