Skip to content

Instantly share code, notes, and snippets.

View rafaduran's full-sized avatar

Rafael Durán Castañeda rafaduran

  • Atlas Information Technology S.A.
  • Barcelona, Catalonia, Spain
View GitHub Profile
@nicosantangelo
nicosantangelo / Gruntfile.js
Created February 17, 2014 18:05
grunt-watch configuration to run with Rails and Jasmine (grunt-contrib-jasmine)
// This file expects the specs to have the same name ending with '.spec.js' and to be in the same folder structure than the source
// Example:
// /app/assets/javascripts/models/todo.js
// /spec/javascripts/models/todo.spec.js
// It runs only the spec of the changed file or, if it's not found, runs the entire suite
module.exports = function(grunt) {
grunt.initConfig({
jasmine: {
all: {
@eerien
eerien / forms.py
Last active May 12, 2024 11:20
Comma Separated Values Form Field for Django. There are CommaSeparatedCharField, CommaSeparatedIntegerField.
from django import forms
from django.core import validators
from django.core.exceptions import ValidationError
class MinLengthValidator(validators.MinLengthValidator):
message = 'Ensure this value has at least %(limit_value)d elements (it has %(show_value)d).'
class MaxLengthValidator(validators.MaxLengthValidator):
message = 'Ensure this value has at most %(limit_value)d elements (it has %(show_value)d).'
@rubiojr
rubiojr / D10apt-ftparchive-hook
Created November 26, 2012 11:46
My pbuildderrc
#!/bin/bash
# 2009-04-09 tyler - use previously built packages as an apt source
# http://blog.edseek.com/~jasonb/articles/pbuilder_backports/pbuilderbuild.html#pbuilderhook
#
# Add this hook to ~/.pbuilder-hooks/D10apt-ftparchive and make it executable
#
echo Calling $0
: ${DIST:=$(lsb_release --short --codename)}
@cburyta
cburyta / gist:3824824
Created October 3, 2012 03:29
Example: Librarian in rake task
namespace 'librarian' do
# see https://github.com/applicationsonline/librarian-chef
desc "install cookbooks using librarian-chef"
task "update" do
# sh "librarian-chef update --verbose"
sh "librarian-chef update"
end
end
@techtonik
techtonik / caller_name.py
Created March 21, 2012 19:29
Python - inspect - Get full caller name (package.module.function)
# Public Domain, i.e. feel free to copy/paste
# Considered a hack in Python 2
import inspect
def caller_name(skip=2):
"""Get a name of a caller in the format module.class.method
`skip` specifies how many levels of stack to skip while getting caller
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc.
@bsodmike
bsodmike / spec_helper.rb
Created June 27, 2011 10:52
RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

Steps to follow, Ref:

  • Update Gemfile
  • bundle install
  • rails g rspec:install
  • Edit .rspec