Skip to content

Instantly share code, notes, and snippets.

@hugosolar
hugosolar / bash-copy-newer file
Last active December 19, 2015 00:49
bash script que comprueba si archivos css en origen son mas nuevos que los del destino y los copia. y si no existe el directorio lo crea.
#!/bin/bash
for file in ./front-themes/*; do
if [ -d $file ]; then
DIRECTORY="${file##"./front-themes/"}"; #obtenemos el nombre del directorio de origen y lo aislamos (debe haber algo mas elegante para hacerlo)
if [[ "$DIRECTORY" == *"-2013" ]]; then
STYLE1="$file/style.css"; #archivo fuente
STYLE2="./htdocs/wp-content/themes/$DIRECTORY/style.css"; #archivo destino
DIRECTORY2="./htdocs/wp-content/themes/$DIRECTORY/"; #directorio de destino
if [[ "$STYLE1" -nt "$STYLE2" ]]; then #comparamos si origen es mas nuevo que destino
@hugosolar
hugosolar / youtube_video.php
Last active December 14, 2015 15:58
Youtube video class for wordpress
<?php
/**
* Obtain youtube video API object and transients it
* eg. $video = new youtube_videos('simonscat');
* $video->get_videos(array('offset' => 5,'num_videos' => 10));
* @param $account string Account youtube name
* @return none
* @author Hugo Solar <[email protected]>
* */