This file contains hidden or 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
DO $$ | |
DECLARE | |
tables CURSOR FOR (SELECT TABLE_NAME as "name", COLUMN_NAME as "column" FROM INFORMATION_SCHEMA.COLUMNS WHERE (DATA_TYPE LIKE '%char%' OR DATA_TYPE = 'text') AND TABLE_SCHEMA = 'public'); | |
BEGIN | |
FOR table_record IN tables LOOP | |
EXECUTE 'UPDATE public.' || table_record.name ||' SET ' || table_record.column || ' = REPLACE(' || table_record.column || ', ''é'',''é'')'; | |
EXECUTE 'UPDATE public.' || table_record.name ||' SET ' || table_record.column || ' = REPLACE(' || table_record.column || ', ''ä'',''ä'')'; | |
EXECUTE 'UPDATE public.' || table_record.name ||' SET ' || table_record.column || ' = REPLACE(' || table_record.column || ', ''ö'',''ö'')'; | |
EXECUTE 'UPDATE public.' || table_record.name ||' SET ' || table_record.column || ' = REPLACE(' || table_record.column || ', ''Ã¥'',''å'')'; | |
EXECUTE 'UPDATE public.' || table_record.name ||' SET ' || table_record.column || ' = REPLACE(' || table_record.column || ', ''è'',''è'')'; |
This file contains hidden or 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 | |
/* | |
* Inspired by https://github.com/damiankw/google.imagesearch | |
*/ | |
class GoogleImageSearch | |
{ | |
public function findImagesForQuery(string $query): array | |
{ | |
$html = $this->queryGoogle($query); | |
$pattern = '/\bhttps?:\/\/\S+(?:jpg)\b/'; |
This file contains hidden or 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 readCsv(string $filename, string $delimiter = ',', string $enclosure = '"', string $escape = '\\'){ | |
ini_set('auto_detect_line_endings', true); | |
$row = 0; | |
$headers = []; | |
if (($handle = fopen($filename, 'r')) !== FALSE) { | |
while (($data = fgetcsv($handle, 0, $delimiter, $enclosure, $escape)) !== FALSE) { | |
$row++; | |
if(1 === $row){ | |
$headers= $data; |