Skip to content

Instantly share code, notes, and snippets.

View inakiquenerapu's full-sized avatar
🎯
Focused

Iñaki Quenerapú inakiquenerapu

🎯
Focused
  • Boa Idea
  • Santiago de Compostela (Spain)
  • 02:14 (UTC +02:00)
View GitHub Profile
@inakiquenerapu
inakiquenerapu / index.html
Created December 21, 2020 00:35
Smallest valid HTML file
<!doctype html><html lang="es"><title>.</title>
@inakiquenerapu
inakiquenerapu / checkJSON.php
Created August 24, 2020 09:37
Comprueba que el JSON es correcto
<?php
//here is my initial string
$sJson = $_POST['json'];
//try to decode it
$json = json_decode($sJson);
if (json_last_error() === JSON_ERROR_NONE) {
//do something with $json. It's ready to use
} else {
//yep, it's not JSON. Log error or alert someone or do nothing
}
@inakiquenerapu
inakiquenerapu / getUrlFriendlyString.js
Last active August 24, 2020 09:11
Generates a URL-friendly string
function getUrlFriendlyString(str,space="-"){ // Generates a SEO friendly URL (ok, the artisan way)
// https://jakubmarian.com/wp-content/uploads/2017/02/special-characters-european-languages.jpg
// Covers Spanish, Turkish, Romanian, German, French...
let findArray = ["á","à","â","ä","ã","å","ă","æ",
"é","è","ê","ë",
"í","ì","î","ï","ı",
"ó","ò","ô","ö","õ","ø",
"ú","ù","û","ü",
"þ","ß","ð","ğ","ñ","ç","š","ş","ș","ț","ý","ÿ","ž",
@inakiquenerapu
inakiquenerapu / changePNGColor.html
Last active July 5, 2020 20:53
Change transparent PNG color with CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Change transparent PNG color with CSS</title>
</head>
<body>
<label>Color</label>
<input class="target" type="text" placeholder="target hex" value="#00a4d6">
@inakiquenerapu
inakiquenerapu / footer.php
Last active January 7, 2020 18:46
Footer file template for TRECE
@inakiquenerapu
inakiquenerapu / header.php
Last active January 7, 2020 18:46
Header file template for TRECE
<?php if(!defined("TRECE")):header("location:/");die();endif;?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" media="screen" href="<?=REALPATH.$conf["dir"]["themes"].$conf["trece"]["theme"];?>/<?=$conf["file"]["styles"];?>.php?pt=<?=$conf["css"]["paddingtop_h"];?>&sf=<?=$conf["css"]["stickyfooter_h"];?>&<?=time();?>">
<script src="<?=REALPATH.$conf["dir"]["themes"].$conf["trece"]["theme"];?>/<?=$conf["file"]["scripts"];?>.php?<?=time();?>"></script>
</head>
<body>
@inakiquenerapu
inakiquenerapu / javascript.php
Last active January 7, 2020 16:44
Javascript file template for TRECE
<?php
header("content-type:application/javascript");
echo <<<ENDJS
@charset "UTF-8";
/* Your Javascript here */
function(foo){
@inakiquenerapu
inakiquenerapu / styles.php
Last active January 7, 2020 16:38
Cascading style sheet file template for TRECE
<?php
header("content-type:text/css");
echo <<<ENDCSS
@charset "UTF-8";
/* Your CSS here */
body{background:pink;}
@inakiquenerapu
inakiquenerapu / trece.php
Created January 5, 2020 12:11
TRECE downloader
<?php
function rrmdir($dir) {
if(is_dir($dir)): $files=scandir($dir); foreach($files as $file): if($file != "." && $file != ".."): rrmdir("$dir/$file"); endif; endforeach; rmdir($dir);
elseif(file_exists($dir)): unlink($dir);
endif;
}
function rcopy($src,$dst){
if(is_dir($src)): mkdir($dst); $files=scandir($src); foreach($files as $file): if($file != "." && $file != ".."): rcopy("$src/$file","$dst/$file"); endif; endforeach;

Keybase proof

I hereby claim:

  • I am quenerapu on github.
  • I am quenerapu (https://keybase.io/quenerapu) on keybase.
  • I have a public key ASBYXo5g9kFgt-oSkCIrJQht93sPsbZjpdqE1XYkpE98cgo

To claim this, I am signing this object: