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
#!/usr/bin/php | |
<?php | |
error_reporting(0); | |
//https://github.com/fzaninotto/Faker | |
require_once 'faker/autoload.php'; | |
$faker = Faker\Factory::create('it_IT'); // create a Italy | |
//CSV TITLE LINE | |
$headers = array('unique_client_pk', 'sesso', 'nome', 'cognome', 'email', 'citta', 'cap', 'provincia', 'anno di nascita', 'registrazione', 'partner_pk', ); |
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 | |
/* | |
* Translate URL: translate.yandex.com | |
* YANDEX translate documentation: http://api.yandex.com/translate/doc/dg/concepts/About.xml | |
*/ | |
interface ITranslate { | |
public static function getMsg($return_status_code = FALSE); |
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
/** | |
* isValidDate(str) | |
* @param string str value yyyy-mm-dd | |
* @return boolean true or false | |
* IF date is valid return true | |
*/ | |
function isValidDate(str){ | |
// STRING FORMAT yyyy-mm-dd | |
if(str=="" || str==null){return false;} | |
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
Doctrine generate entity/entities from database:table | |
php app/console doctrine:mapping:import --force GleamPageBundle xml | |
php app/console doctrine:mapping:convert annotation ./src | |
php app/console doctrine:generate:entities GleamPageBundle | |
Creating the Database Tables/Schema | |
php app/console doctrine:schema:update --force | |
------------------------ |
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
Twig list and dinamic url | |
{% extends 'GleamPageBundle::base.html.twig' %} | |
{% block body %} | |
{% if pages %} | |
<ul> | |
{% for page in pages %} | |
<li><a href="{{ path('gleam_page_showcontent', {'id': page.id}) }}" target="_blank" title="{{ page.title }}">{{ page.title }}</a></li> | |
{% endfor %} | |
</ul> |
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
#!/usr/bin/php | |
<?php | |
$folder = dirname(__FILE__)."/"; | |
//or you can set this by manual | |
//$folder = "/var/www/lorem/ipsum/" | |
$outputFolder = "mp4/"; | |
$from = ".flv"; | |
$to = ".mp4"; |
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
$arr = [[1,2,[3]],4]; | |
$newArr = array(); | |
foreach( (new RecursiveIteratorIterator(new RecursiveArrayIterator($arr))) as $val) { | |
$newArr[] = $val; | |
} | |
var_dump($newArr); |
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 | |
/** | |
* Class File | |
*/ | |
class File | |
{ | |
private $fileName; | |
private $file; |
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
ipToLong = function toInt(ip){ | |
var ipl=0; | |
ip.split('.').forEach(function( octet ) { | |
ipl<<=8; | |
ipl+=parseInt(octet); | |
}); | |
return(ipl >>>0); | |
}; | |
ipFromLong = function fromInt(ipl){ |
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
function validateIp(ipaddress) | |
{ | |
if (/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/.test(ipaddress)) | |
{ | |
return (true) | |
} | |
return (false) | |
} |
OlderNewer