Skip to content

Instantly share code, notes, and snippets.

@joanhey
joanhey / php-server.contract
Last active Jan 21, 2017
para lanzar desde Elementary OS el servidor incluido en php, en localhost:8000. copiar el php-server.contract en /usr/share/contractor .
View php-server.contract
[Contractor Entry]
Name=PHP server
Icon=network-server-symbolic
Description=Open PHP server
MimeType=inode/directory;application/x-httpd-php;application/x-php;
Exec=php -S 0.0.0.0:8000 -t %u
Gettext-Domain=php-server
Type=Application
StartupNotify=true
Terminal=true
@joanhey
joanhey / Dockerfile
Last active Aug 19, 2019
Docker con apache y php7
View Dockerfile
FROM php:7.0-apache
RUN apt-get update \
&& apt-get install -y git zlib1g-dev \
&& docker-php-ext-install zip opcache\
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www!g' /etc/apache2/apache2.conf
WORKDIR /var/www
View debugbar.phtml
<!-- begin debugbar -->
<div id="sfMiniToolbar" class="sf-minitoolbar">
<a href="javascript:void(0);" title="Show KumbiaPHP toolbar" onclick="
var elem = this.parentNode;
if (elem.style.display == 'none') {
document.getElementById('sfToolbarMainContent').style.display = 'none';
document.getElementById('sfToolbarClearer').style.display = 'none';
elem.style.display = 'block';
} else {
document.getElementById('sfToolbarMainContent').style.display = 'block';
@joanhey
joanhey / php-server.desktop
Last active Dec 6, 2018
para lanzar desde linux el servidor incluido en php, en localhost:8000. copiar el php-server.desktop en /home/tu-usuario/.local/share/applications.
View php-server.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=PHP server
GenericName=Servidor web incluido en php
Comment=Servidor web incluido en PHP > 5.4
Icon=network-server-symbolic
TryExec=php
Exec=php -S 0.0.0.0:8000 -t %u
NoDisplay=true
@joanhey
joanhey / shell change tabs for spaces
Last active Mar 2, 2016
Cambiar la identación de tabs a espacios en todos los ficheros php de un directorio recursivamente
View shell change tabs for spaces
find . -type f -name '*.php' -exec bash -c 'expand --tabs=4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@joanhey
joanhey / gitcontributors.phtml
Last active Jan 22, 2016
Kumbia Partial: show git contributors to KumbiaPHP
View gitcontributors.phtml
<h2>Gracias a todos los colaboradores</h2>
<?php
ini_set("user_agent", 'KumbiaPHP bot');
$url = 'https://api.github.com/repos/KumbiaPHP/KumbiaPHP/contributors';
$team = json_decode(file_get_contents($url));
foreach($team as $user) :?>
<a href="https://github.com/<?= $user->login?>" title="@<?= $user->login?>">
<img src="<?= $user->avatar_url ?>&s=60" width=60 height=60 alt="<?= $user->contributions?> contribuciones"></a>
<?php endforeach ?>
@joanhey
joanhey / feed.phtml
Last active Jan 28, 2016
Kumbia Partial: show feed
View feed.phtml
<?php
/**
* Visualizar feed RSS por Joanhey
*
* @param string $name Nombre
* @param string $url URL completa del feed
* @return html
*/
if ($feed = simplexml_load_file($url)): ?>
@joanhey
joanhey / sociable.phtml
Last active May 29, 2019
Kumbia Partial: enlaces para compartir en redes sociales
View sociable.phtml
<div id="social">
<p>¡Compártelo!</p>
<?php $url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];
$titulo = View::getVar('page_title'); //Necesita el título de página ?>
<a class="social facebook" rel="nofollow noopener noreferrer" href="https://www.facebook.com/share.php?u=<?=$url?>&amp;t=<?= urlencode($titulo)?>" title="Facebook" target="_blank"></a>
<a class="social twitter" rel="nofollow noopener noreferrer" href="https://twitter.com/intent/tweet?text=<?= urlencode($titulo)?>&amp;url=<?=$url?>&amp;via=KumbiaPHP" title="Twitter" target="_blank"></a>
</div>