Skip to content

Instantly share code, notes, and snippets.

View joanhey's full-sized avatar

Joan Miquel joanhey

View GitHub Profile
@joanhey
joanhey / sociable.phtml
Last active May 29, 2019 01:44
Kumbia Partial: enlaces para compartir en redes sociales
<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>
@joanhey
joanhey / feed.phtml
Last active January 28, 2016 16:03
Kumbia Partial: show feed
<?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 / gitcontributors.phtml
Last active January 22, 2016 21:25
Kumbia Partial: show git contributors to KumbiaPHP
<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 / shell change tabs for spaces
Last active March 2, 2016 20:36
Cambiar la identación de tabs a espacios en todos los ficheros php de un directorio recursivamente
find . -type f -name '*.php' -exec bash -c 'expand --tabs=4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@joanhey
joanhey / php-server.desktop
Last active December 6, 2018 01:50
para lanzar desde linux el servidor incluido en php, en localhost:8000. copiar el php-server.desktop en /home/tu-usuario/.local/share/applications.
[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 / debugbar.phtml
Created May 25, 2016 14:27
Partial debugbar
<!-- 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 / Dockerfile
Last active August 19, 2019 11:05
Docker con apache y php7
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
@joanhey
joanhey / php-server.contract
Last active January 21, 2017 17:37
para lanzar desde Elementary OS el servidor incluido en php, en localhost:8000. copiar el php-server.contract en /usr/share/contractor .
[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