Skip to content

Instantly share code, notes, and snippets.

View trico's full-sized avatar
🚀
Brrrrrr

Eric Ponce trico

🚀
Brrrrrr
  • Barcelona, Spain
View GitHub Profile
#!/usr/bin/python
import subprocess
archivos = subprocess.check_output(["git", "diff", "HEAD^", "HEAD", "--name-only"])
try:
print subprocess.check_output("grep -nHe console " + archivos.replace('\n', ' '), stderr=subprocess.STDOUT, shell=True)
except Exception, e:
print
@trico
trico / sublime.bat
Created May 6, 2012 15:30
Git commit msg
"C:\Program Files\Sublime Text 2\sublime_text.exe" --wait --new-window "%1"
@trico
trico / gist:2958648
Created June 20, 2012 07:35
Añadir una clase para cada uno de los elemento de wp_nav_menu
<?php
function new_nav_menu_items($output) {
$idstr = preg_match_all('/<li class="page_item page-item-(\d+)/', $output, $matches);
foreach($matches[1] as $mid){
$slug = basename(get_permalink($mid));
$output = preg_replace('/page-item-'.$mid.'(| current_page_item)">/', 'page-item-'.$mid.' page-item-'.$slug.'">', $output, 1);
}
@trico
trico / try.json
Last active October 6, 2015 16:48
[
{
"es": "lunes",
"en": "monday"
},
{
"es": "martes",
"en": "tuesday"
}
,
@trico
trico / gist:3163810
Created July 23, 2012 14:11
Curl php proxy
<?php
$url = 'url';
$proxyauth = 'user:pass';
$proxy = 'proxy.server.es';
$proxyPort = '8080';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
//proxy suport
@trico
trico / gist:3817341
Created October 2, 2012 08:31
alternativa text-indent
height: 0; overflow: hidden; padding-top: 20px;
#!/bin/bash
tail -n +2 $1 | split -l 10000 - split_
for file in split_*
do
head -n 1 $1 > tmp_file
cat $file >> tmp_file
mv -f tmp_file output/$file.csv
rm $file
done
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
@trico
trico / gist:224323bb0abd4bf51ccc
Last active August 29, 2015 14:24
lines count
find . -name '*.txt' -print0 | xargs -0 wc -l
@trico
trico / formaters.json
Created May 10, 2017 08:27
barcode formater
{
"coupon_id": {
// representer solo tiene format e includes_control
"representer": {
"format": "ean_13", // posible valores 'ean_13', 'code_25_interleaved', 'code_39', 'code_128'
"includes_control": true // posibles valores true/false
},
// formater tiene max_size, prefix y format