Skip to content

Instantly share code, notes, and snippets.

@javifr
javifr / Postgres SQl Slugify
Created April 13, 2016 10:10
Regexp to slugify a string field
select XXXX , regexp_replace(
translate(
replace(lower(replace(lower(replace(lower(replace(lower(replace(lower(replace(lower(YOURFIELDNAME), 'ñ', 'n')), 'º', 'o')), 'ª', 'a')), 'ç', 'c')), '-', '_')), ' ', '_'), 'áàâãäåāăąÁÂÃÄÅĀĂĄèééêëēĕėęěĒĔĖĘĚìíîïìĩīĭÌÍÎÏÌĨĪĬóòôõöōŏőÒÓÔÕÖŌŎŐùúûüũūŭůÙÚÛÜŨŪŬŮ','aaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiooooooooooooooouuuuuuuuuuuuuuuu'
), '[^\w -]', '', 'g')
from YYYYY
# Normal locations fetching
# page_url IS http://localhost:3000/api/v1/locations?page=1
# Nearby locations fetching
# page_url SHOULD BE http://localhost:3000/api/v1/locations?latitude=41.406410&longitude=2.191986&distance=10&near=true?page=1
# page_url IS http://localhost:3000/api/v1/locations?page=1
# How can i maintain this params?
# ?latitude=41.406410&longitude=2.191986&distance=10&near=true?
@javifr
javifr / gist:5024704
Created February 24, 2013 17:28
post-receive ( hook de un repo git, sincro de ramas develop y master a stages de preproducción y producción )
#!/bin/sh
echo "=============================="
echo "Pull del central repo "
echo "=============================="
echo "=========== PRO ============="
cd ~/www/projectroot
unset GIT_DIR
git pull origin master
@javifr
javifr / theme-my-login.php
Created July 18, 2012 18:36
Theme My Login - Helpers!
<?php
/*
// Añadimos un campo llamado user_telephone
- ojo al if(!is_admin )
- ojo en que fichero se meten las líneas de códigon ( tenemos tres ficheros )
- dependencia del plugin Theme My Login
*/
@javifr
javifr / gitsubmodules.md
Created July 10, 2012 15:02
git submodules help

Basic commands with git submodules

Cloning a repo that has submodules

git clone --recursive XXXXX.git path

Modify content of a submodule from your project

cd to de path of the subdmoule and work normally

Adding a submodule

git submodule add XXXXX.git path/path

@javifr
javifr / jqm-theme-swatch.less
Created July 21, 2011 15:06
jquerymobile theme swatch - LESS
//Vars para theme nuevo
@a_color:#ffffff;
@a_text_shadow:#000000;
//bar
@a_bar_gradient_start:#3c3c3c;
@a_bar_gradient_stop:#111111;
@a_bar_border:#2A2A2A;
@a_bar_background:#111111;
@a_bar_link:#7cc4e7;
@javifr
javifr / git-cheatsheet.mkd
Created May 18, 2011 15:44
git cheatsheet

GIT CHEATSHEET

De una máquina a otra en la misma red

( siendo xxxx ip de la máquina y YYYYYY carpeta del repo )
CLONE
git clone -u /usr/local/git/bin/git-upload-pack ssh://XXXXXXX/users/javier/Sites/YYYYYYYYY

PULL
git pull --upload-pack /usr/local/git/bin/git-upload-pack ssh://XXXXXXX/users/javier/Sites/YYYYYYYYY

@javifr
javifr / gitignore Wordpress nested Codeigniter
Created May 18, 2011 14:46
gitignore template for Wordpress with nested Codeigniter
##### importante para poder comitar carpetas vacias
##### hay que introducir un gitignore en cada carpeta que quieras vacia con:
##### *
##### !.gitignore
!.gitignore
##### Global files
@javifr
javifr / gitignore Codeigniter
Created May 18, 2011 14:40
gitignore template for CodeIgniter
##### importante para poder comitar carpetas vacias
##### hay que introducir un gitignore en cada carpeta que quieras vacia con:
##### *
##### !.gitignore
!.gitignore
##### Global files
@javifr
javifr / gitignore Wordpress
Created May 18, 2011 14:37
gitignore template for wordpress
# basado en : https://gist.github.com/444295
# Ignora todo lo que no sea de wp ( por si hay otras cosas en root )
/*
!.gitignore
!wp-content/
!index.php