Skip to content

Instantly share code, notes, and snippets.

View sourcerebels's full-sized avatar

Edu Rodríguez Castillo sourcerebels

View GitHub Profile
@sourcerebels
sourcerebels / LoadSpringConfig.java
Created February 8, 2010 09:06
How to load Spring XML configuration file from Java
public class LoadSpringConfig {
public static void main(String[] args) {
String[] configurationFiles = { "path_to_your_spring_xml_configuration_file" };
ApplicationContext ctx = new FileSystemXmlApplicationContext(configurationFiles);
}
}
@sourcerebels
sourcerebels / .gitignore
Created February 8, 2010 20:02
Contains patterns for files or folders we want to be unversioned
# For Maven based projects
target
target/*
# IDE dependant files
# NetBeans
nb-configuration.xml
@sourcerebels
sourcerebels / config
Created February 28, 2010 18:22
~/.config/terminator/config
use_theme_colors=False
background_color=#222222
foreground_color=#707678
font = Andale Mono 10
palette=#22cc22dd22ee:#aaee44774477:#669966cc5599:#cc77cc9933dd:#66ff9999bb44:#aaaa88ccbbff:#6688bb44bb11:#770077667788:#aa33aa55aa66:#eeee66336633:#9900aa5577dd:#dd00cc5544dd:#77cc9966bb00:#88ff44cc7700:#22dd88228855:#ee22ee22ee22
scrollback_lines = '500'
cursor_blink = True
background_darkness=0.0
force_no_bell=true
handle_size=0
@sourcerebels
sourcerebels / exception2String.java
Created March 1, 2010 13:17
exception2String Print exception's stack trace to a string
/**
* Transforms a Exception stack trace into String.
* @param e The exception to be transformed.
* @return A string with the stack trace text.
*/
public String exception2String(Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
@sourcerebels
sourcerebels / cpl.py
Created December 11, 2010 22:13
Implementación en Python muy pobre de la cata "Caesar plays Lottery" <http://codingkata.org/katas/unit/caesar-lottery> con expresiones regulares y una tabla de conversión. El objetivo de este ejercicio fue: * Instalar el intérprete de Python. * Config
'''
Created on 11/12/2010
@author: Eduardo Rodriguez Castillo <http://sourcerebels.com>
'''
import re
def convert(number=1):
conversionTable = ((50, "L"),(40, "XL"),(10, "X"),(9, "IX"),(5, "V"), (4, "IV"))
@sourcerebels
sourcerebels / isAlive.py
Created December 17, 2010 14:54
Check if Google's URL is avaliable
'''
Created on 17/12/2010
@author: Edu Rodriguez Castillo <http://www.sourcerebels.com>
'''
import urllib2
def isAlive(url):
try:
@sourcerebels
sourcerebels / dummyResponse.json
Created February 12, 2011 16:33
Prototype AJAX-JSON-DOM Manipulation first test
[ { "fields" : { "created" : "2011-02-07 13:41:37",
"modified" : "2011-02-07 13:41:37",
"tags" : [ 1,
2
],
"text" : "Ultimo contenido",
"title" : "Ultimo contenido"
},
"model" : "blog.content",
"pk" : 5
@sourcerebels
sourcerebels / diff.py
Created February 14, 2011 17:30
python script to use meld as diff tool for git diff
#!/usr/bin/python
# USE: git config --global diff.external diff.py
import sys
import os
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
@sourcerebels
sourcerebels / pimp-my-gedit.sh
Created February 15, 2011 08:03
This script installs some useful gedit plugins
sudo apt-add-repository ppa:ubuntu-on-rails/ppa
sudo apt-get update
sudo apt-get install gedit-plugins gedit-gmate
@sourcerebels
sourcerebels / gvimrc
Created February 15, 2011 09:19
Vim > Configuration
" Set the font
set guifont=Inconsolata\ 12
" My favourite color scheme for the GUI
colorscheme koehler
" Remove toolbar
set guioptions-=T
" Remove right scrollbar