Skip to content

Instantly share code, notes, and snippets.

View andrefs's full-sized avatar

André Santos andrefs

View GitHub Profile
" Configuration file for Vim
" Place in: ~/.vimrc
" André Santos
" 2009.10.18
" Turn off vi compatibility mode
set nocompatible
" Turn off message 'Thanks for flying vim'
" set notitle
@andrefs
andrefs / em_mwe.pl
Created October 3, 2012 16:31
Elastic::Model 'extends' MWE
package MyApp;
use Elastic::Model;
has_namespace 'myapp' => {
user => 'MyApp::EMUser',
};
package MyApp::User;
use Moose;
@andrefs
andrefs / emtu_mwe.pl
Created December 3, 2012 15:58
Moose type unions in Elastic::Model
package MyApp;
use Elastic::Model;
has_namespace 'myapp' => {
user => 'MyApp::User',
};
package Class1;
use Moose;
package Class2;
@andrefs
andrefs / cmv.pl
Created March 20, 2013 16:41
CPAN module version
#!/usr/bin/env perl
# Prints version for each CPAN module taken as argument
for(@ARGV){
my $sentence = 'perl -M'.$_.' -e \'print '.'"$'.$_.'::VERSION\n"'.'\'';
print "$_\t";
print qx{$sentence};
}
@andrefs
andrefs / gist:5323149
Created April 5, 2013 22:21
Screenshots directly to dropbox with public link in clipboard
#!/bin/bash
# Creates a screenshot from a region of the display,
# uploads it to Dropbox public folder and copies
# the link to the clipboard.
#
# Dependencies:
# xfce4-screenshooter
# dropbox
# x-clip
@andrefs
andrefs / .gitconfig
Created May 10, 2013 13:56
Examples of useful stuff to have in your global git config file
[user]
name = User Name # to be used in commits
email = user@email # to be used in commits
[difftool]
prompt = false
[diff]
tool = meld # use meld as 'git difftool' application
[color]
ui = true
diff = auto
@andrefs
andrefs / Ink_datepicker.html
Last active December 21, 2015 00:39
Ink.js Datepicker plugin
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://cdn.ink.sapo.pt/2.2.0/css/ink.css">
<!--script type="text/javascript" src="http://cdn.ink.sapo.pt/2.2.0/js/ink.min.js"></script-->
<!--script type="text/javascript" src="http://cdn.ink.sapo.pt/2.2.0/js/ink.datepicker.js"></script-->
<script type="text/javascript" src="http://cdn.ink.sapo.pt/2.2.0/js/ink-all.min.js"></script>
</head>
<body>
<input type="text" id="date" class="ink-datepicker">
<script>
@andrefs
andrefs / makefile
Last active December 25, 2015 04:39
makefile
SHELL := /bin/bash
copy2cloud: covers_percentage_small_pt_title.txt covers_percentage_small_title.txt last_small_covers_pt_title.txt last_small_covers_title.txt
cp last_small_covers_pt_title.txt covers_percentage_small_pt_title.txt covers_percentage_small_title.txt last_small_covers_title.txt ~/public_html/CloudPT/sapo/banca_covers_stats
# ALL PT
all_covers_pt.txt: all_covers_pt.json
cat all_covers_pt.json | head -n-1 | tail -n+2 | sed 's/^[^0-9]*\([0-9]\+\)[^0-9]*/\1/' | sort -n > all_covers_pt.txt
@andrefs
andrefs / fix_csv.pl
Created November 18, 2013 18:32
Normalize CSV (read & write)
#!/usr/bin/env perl
use strict; use warnings;
use Data::Dump qw/dump/;
use feature qw/say/;
use Text::CSV::Auto;
use Text::CSV::Auto::ExportTo::CSV;
my $in = shift or die "Usage: $0 input.csv";
### Keybase proof
I hereby claim:
* I am andrefs on github.
* I am andrefs (https://keybase.io/andrefs) on keybase.
* I have a public key whose fingerprint is 9855 D11E 4674 3E1E 1F1A F85F 1E53 063F 6F27 1B13
To claim this, I am signing this object: