Skip to content

Instantly share code, notes, and snippets.

module.exports = require("./webpack.make-config")({
styleguide: true,
mocks: true,
debug: true,
devel: true
});
@alberto
alberto / multiple returns
Created July 29, 2013 20:42
¿Cómo expresarías esto con un sólo return por método?
module DownloadPolicy
def self.allow_download_for?(screencast, user)
return false unless screencast.published?
return true if screencast.free?
return false if user.nil?
return user.has_screencast_access?
end
end
@alberto
alberto / movin-in.markdown
Created March 4, 2012 00:14
A markdown example
layout title date comments categories
post
Movin' in
2012-03-03 23:00
true
github
octopress
blogging

You probably have noticed this blog got a facelift. I've moved from blogger to github, using a cool feature called github-pages,

require "test_notifier/runner/rspec"
TestNotifier.default_notifier = :notify_send
class User
attr_reader :name, :age
def initialize(name, age)
@name, @age = name, age
end
end
@alberto
alberto / greed.rb
Created January 5, 2011 16:59
Correcciones de greed para xaviuzz
def score(dice)
compute_singles(dice) + compute_triples(dice)
end
def compute_singles(diceRoll)
diceRoll.each.inject(0) {|result, roll| result + single_value(roll) }
end
SINGLE_VALUES = { 1 => 100 , 5 => 50}
def single_value(roll)
@alberto
alberto / string_calculator_specs.rb
Created January 4, 2011 19:26
String Calculator Kata
require "test_notifier/runner/rspec"
TestNotifier.default_notifier = :notify_send
RSpec::Matchers.define :add_to do |expected|
match do |string|
string.add == expected
end
end
module AddableString
@alberto
alberto / score.rb
Created December 20, 2010 00:47
implementation of about_scoring_project ruby koan
def score(dice)
return score_for_each_die(dice) + score_for_sets_of_three(dice)
end
def score_for_each_die(dice)
dice.inject(0) do |sum, die|
sum + score_for(die)
end
end
#!/usr/bin/env python
import feedparser
import pynotify
import time
BASE_TITLE = 'Hudson Update!'
TIMEOUT = 3000
def success(job, build):
n = pynotify.Notification(BASE_TITLE,
newgraph
title : Burndown Chart
xaxis
label : Dias
size 5
hash 1 mhash 0 no_auto_hash_labels
hash_labels hjr vjc font Helvetica
hash_labels rotate 90
hash_label at 0 : Lunes
hash_label at 1 : Martes
@alberto
alberto / UoW
Created October 16, 2009 15:54
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
/*
* TODO:
* auto_discovery_link_tag