This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Que es code smell? | |
son todos los síntomas que podemos encontrar en el código fuente de un sistema que indican que muy probablemente existan problemas más profundos de calidad de código, de diseño o de ambos | |
Metodos largos, clases largas o duplicar codigo son algunos code smell | |
Long Method? | |
def parse(arg, argv, &error) | |
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0])) | |
return nil, block, nil # +1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://yuml.me/diagram/scruffy/class/# Cool UML Diagram, [Cat]^-[Animal], [Bird]^-[Animal], [Bird]++->[SoldierAnimal], [Animal] ++->1[movement], [movement]++->1[MovementType], [MovementType]++->1[Motile], [MovementType]++->1[Sessility], [Motile]++->1[chemotaxis], [Motile]++->1[thermotaxis], [Motile]++->1[phototaxis], [Motile]++->1[magnetotaxis], [Motile]++->1[galvanotaxis], [Motile]++->1[gravitaxis], [Motile]++->1[durotaxis], [Motile]++->1[haptotaxis], [Motile]++->1[biopolymers], [gravitaxis]++->[Type], [Type]++->1[Air], [Type]++->1[Terrestrial], [Type]++->1[water]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CSS3 No-image Chupa-Chupsy candy | |
* by @girlie_mac | |
* http://girliemac.com/blog/2012/03/24/making-chupa-chups-using-css3-pseudo-elements/ | |
* | |
* Please, do not compare this with the real one. | |
* I feel pretty terrible making the awesome design by Salvador Dalí into some crap. | |
* But my point of this demo is that you can create the floral shape with CSS, using border-radius:50% and pseudo-element(s) | |
*/ | |
html { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; | |
.texture-layer { | |
background: url("texture-chunk-layer.png") repeat scroll 0 0 transparent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; | |
.texture-layer { | |
background: url("texture-chunk-layer.png") repeat scroll 0 0 transparent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/9j/4QBqRXhpZgAATU0AKgAAAAgAAgExAAIAAAAGAAAAJodpAAQAAAABAAAALAAAAABTa2l0Y2gA | |
BJAAAAcAAAAEMDIxMKABAAMAAAABAAEAAaACAAQAAAABAAAAKKADAAQAAAABAAAAKAAAAAD/4AAQ | |
SkZJRgABAQAAAQABAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAH | |
zgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQ | |
ICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAAB | |
UAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFla | |
AAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2 | |
aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAA | |
CAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXds | |
ZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node = Struct.new(:value, :next) | |
list = Node.new("first", nil) | |
#create linked list | |
def linked_list(value, next_node) | |
Node.new(value, next_node) | |
end | |
def unlinked_list(node_value, list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#max sub array sum return sum and sub array kadane's algorithm | |
def max_subarray(collection) | |
temp_sum = 0 | |
max_sum = 0 | |
check_sum = 0 | |
begin_point = 0 | |
end_point = collection.length - 1 | |
max_subarray = [] | |
collection.each_with_index do |element, index| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = 100000.times.map { Random.rand(2000) } | |
t = Time.now | |
yield | |
ruby_sort = numbers.sort | |
p "it tooks #{t-Time.now}s" | |
#[5, -3, 3, 20, -50, 1, -1, 2] | |
def bubblesort( collection ) | |
t = Time.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal #abstract class template pattern base on separete out the things changed from those that stay same | |
def initialize(&kind) | |
@kind = kind | |
end | |
#template patter | |
def live | |
eat | |
make_poop |
OlderNewer