Skip to content

Instantly share code, notes, and snippets.

Verso 1
F C G Am
Alma mía dale gracias,
F C G Am
sus bondades no olvides jamás.
F C G Am
Es tu Dios quien te perdona,
F C G Am
de tus faltas no se acuerda ya.
@robertomiranda
robertomiranda / refactored.rb
Last active June 22, 2017 12:47 — forked from stevebartholomew/gist:1feab9d6fa5128f618c4
Ruby refactoring exercise
class Array
def to_annotated_xml(root)
output = "<#{root}>"
each do |i|
if i.is_a?(Fixnum)
output << "<number>#{i}</number>"
elsif i.is_a?(String)
if i.match(/@/)
output << "<email>#{i}</email>"
var aTags = document.getElementsByTagName('button');
var searchText = "Follow";
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent == searchText) {
found[i].click;
await sleep(1);
}
}
def flatten(elem)
if elem.is_a?(Array)
if elem.empty?
[]
else
head, *tail = elem
flatten(head) + flatten(tail)
end
else
[elem]
require 'active_support/all'
def balance_group(members)
group1, group2 = members.in_groups(2)
mean1, mean2 = (group1.sum/group1.size.to_f), (group2.sum/group2.size.to_f)
if mean1.to_i == mean2.to_i
return [{mean: mean1, group: group1}, {mean: mean2, group: group2}]
else
balance_group(members.shuffle)
end
end

sudo ifconfig (INTERFACE) ether (MAC ADDRESS)

RubyConf Colombia is Back for 2016!

You're more than welcome, encouraged—to go ahead and share the news with your friends and loved ones. In order to make it easier for you, we made this incredible link that you can click on to create a tweet announcing the good news.

What Even Is This?

RubyConf Colombia is our second not-for-profit, community-driven Ruby, Rails and related technologies conference in Medellin, Colombia. The format is two-day conference with a lot of awesome speakers from around the world and locally. The projected attendee number for RubyConf Colombia 2016 is around 250.

More to Come

# Fetch all the "mapping" from elasticsearch using the enpoint
# "/_mapping" and saved them on mapping.json file
# curl http://localhost:9200/_mapping
# parse the results fetched and saved into mapping.json and we iterate over
# the parent index names and start to call the endpoint for delete them
require "json"
keys = JSON.parse(`curl http://localhost:9200/_mapping`).keys
keys.each {|key| `curl -XDELETE http://localhost:9200/#{key}`}
Keep.Behaviors.Internationalization = Marionette.Behavior.extend({
initialize: function(){
var currentStore = "us";
var currentView = this[ currentStore + "Behavior"];
if(typeof currentView != "undefined"){
$.extend(true, this.prototype, currentView)
}
},
templateHelpers: function(){
module SequenceId
extend ActiveSupport::Concern
module ClassMethods
def has_sequence_id(column: "hex_id", sufix: "DBA", rjust_lenght: 3)
after_create do
number = self.id.to_s(16).rjust(rjust_lenght, "0")
self.send("#{column}=", "#{sufix}_#{number}")
self.save
end
end