Skip to content

Instantly share code, notes, and snippets.

View felipelavinz's full-sized avatar

Felipe Lavín Z. felipelavinz

View GitHub Profile
@felipelavinz
felipelavinz / gist:4115548
Created November 20, 2012 02:28
Formulario de Contacto Maestro para Diplomados y Actividades Académicas
<div class="form grid_12 suffix_4">
<div class="field">
<label for="contact-name">Nombre *</label>
[text* nombre id:contact-name class:input-text]
</div>
<div class="field">
<label for="contact-occupation">Ocupación/Profesión</label>
[text ocupacion id:contact-occupation class:input-text]
@felipelavinz
felipelavinz / ArrayMap.php
Created December 12, 2012 21:11
A perhaps naive (but working) way to get info from a variable depth multidimensional associative array
<?php
class ArrayMap{
private $array = array();
private $map;
public function __construct( array $array, $delimiter = '\\' ){
$this->array = $array;
$this->flattenMap( $this->array );
@felipelavinz
felipelavinz / custom-mobile-feed.php
Last active November 11, 2021 22:13
A custom XML feed plugin for WordPress
<?php
/*
Plugin Name: Feed Noticias Móviles
Plugin URI: http://www.udd.cl
Description: Crea un feed de noticias para consumo en aplicación móvil
Version: 0.1
Author: Felipe Lavín (AyerViernes S.A.)
Author URI: http://www.ayerviernes.com
*/
@felipelavinz
felipelavinz / install-dependencies.sh
Last active December 13, 2015 22:08
Trigger automatic compilation for less files with lessc and inoticoming
# Instalar utilidades para agregar repositorios PPA
sudo apt-get install python-software-properties python g++ make
# En Quantal (12.10) podrías necesitar el paquete software-properties-common para usar add-apt-repository
sudo apt-get install software-properties-common
# Agregar repositorio de node.js
sudo add-apt-repository ppa:chris-lea/node.js
# Actualizar información de repositorios
@felipelavinz
felipelavinz / fancybox_cover_embeds.js
Created March 19, 2013 19:13
Cover embed objects when using a lightbox image. It works by creating an iframe behind the lightbox div, with the same dimensions as that.
jQuery(document).ready(function($){
$('.lightbox-img').fancybox({
cyclic: true,
index: 0,
onStart: function(){
},
onComplete: function(){
var wrap = $('#fancybox-wrap'),
outer = $('#fancybox-outer'),
width = outer.width(),
@felipelavinz
felipelavinz / respuesta-api-senado.xml
Created April 3, 2013 22:59
Respuesta del API del Senado de Chile para trámites de un proyecto de ley... esto era lo que escupía cuando funcionaba
<?xml version="1.0" encoding="UTF-8"?>
<proyectos>
<proyecto>
<descripcion>
<boletin>8575-05</boletin>
<titulo>Ley de Presupuestos del sector público para el año 2013.</titulo>
<fecha_ingreso>01/10/2012</fecha_ingreso>
<iniciativa>Mensaje</iniciativa>
<camara_origen>C.Diputados</camara_origen>
<urgencia_actual>Discusión inmediata</urgencia_actual>
#!/bin/bash
# Daniel Verner
# CarrotPlant LLC
# 2011
# Backup each mysql databases into a different file, rather than one big file
# Optionally files can be gzipped (dbname.gz)
#
# Usage: dump_all_databases [ -u username -o output_dir -z ]
#
# -u username to connect mysql server
@felipelavinz
felipelavinz / .htaccess
Created July 6, 2013 17:45
.htaccess default wordpress multisite en subdirectorio
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
@felipelavinz
felipelavinz / brute-thumbnails.php
Created July 19, 2013 04:18
Create image thumbnails with PHP and Imagick
<?php
$abs_start = microtime(true);
$path = __DIR__;
$Directory = new RecursiveDirectoryIterator('.');
$img_extensions = array('jpg', 'jpeg', 'gif', 'png');
@felipelavinz
felipelavinz / EntriesOptions.php
Last active December 20, 2015 10:48
Create Entries Options using an ArrayIterator
<?php
class EntriesOptions extends ArrayIterator{
private $query;
private $cur_post;
public function __construct( $query_params = array(), $flags = array() ){
$args = wp_parse_args( $query_params, array(
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',