This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://repl.it/@dariocangialosi/primesassumofprimes-1 | |
def is_prime(n): | |
prime=True | |
for i in range(2,n): | |
if n%i==0: | |
prime=False | |
break | |
return prime | |
def primes_iterator(start,limit): | |
for n in range(start,limit): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ repl.it: https://repl.it/@dariocangialosi/primesassumofprimesjs | |
// @ gist.github.com: https://gist.github.com/arkenidar/91198b654b119c97284588d6451117c6/ | |
//////////////////////////////////////// | |
primeSum() | |
// the algorithm for: "a prime as sum of primes" | |
function primeSumPrimes(limit=NaN){ | |
var primes=[] | |
for(let n of primesGenerator(0,limit+1)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#PHP+apache+databases | |
#----------------------------- | |
#apache2 | |
#php | |
#php-xdebug | |
#php-sqlite3 | |
#mariadb-server | |
#phpmyadmin | |
#----------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
-- configure as needed: | |
extension=pdo_mysql | |
alter user 'root'@'localhost' identified with mysql_native_password by 'password'; | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- submit text --> | |
<form method="get"> <input name="text"> </form> | |
<?php | |
require 'credentials.php'; $dbname='testdb'; | |
$dbh=initpdo($user,$password,$dbname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html><html><head> | |
<meta charset="utf-8"><title></title> | |
</head><body> | |
<form name="fattura_form"><input type="submit"></form> | |
<template id="template_fattura"> | |
<fieldset class="fatture"> | |
quantita | |
<input type="text" name="qta[]" value="1"> | |
prezzo unitario |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function handle_request($REQUEST){ | |
// Note: To use cookie-based sessions, session_start() | |
// must be called before outputting anything to the browser. | |
@session_start(); | |
?> | |
<!doctype html> | |
<body> | |
<?php | |
//$REQUEST=$_REQUEST;//['action'=>'login','user'=>'user@gmail.com','password'=>'secret'];//$_REQUEST; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path='download.php'; // CHANGE IT | |
$finfo = finfo_open(FILEINFO_MIME_TYPE); | |
header('Content-Type: '.finfo_file($finfo, $path)); | |
$finfo = finfo_open(FILEINFO_MIME_ENCODING); | |
header('Content-Transfer-Encoding: '.finfo_file($finfo, $path)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html><meta charset="UTF-8"> | |
<title>Facebook Login in JavaScript</title> | |
<body> | |
<script> | |
function checkLoginState(){ | |
FB.getLoginStatus(response=>statusChangeCallback(response)) | |
} | |
function statusChangeCallback(response) { | |
if(response.status === 'connected') | |
FB.api('/me',function(response){document.all.status.innerHTML='Thanks for logging in, '+response.name}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
@session_start(); | |
// https://github.com/facebook/php-graph-sdk | |
//composer require facebook/graph-sdk | |
require_once __DIR__ .'/vendor/autoload.php'; | |
require 'app_settings.php'; | |
function fb(){ | |
require 'app_settings.php'; |