Skip to content

Instantly share code, notes, and snippets.

require 'base64'
class String
def im_your_father
Base64.decode64("Tk9PT29vb09PT09vb09PT09Pb29vT09Pb29v")
end
end
class Duck
def talk
puts "quack!"
end
end
class Cow
def talk
puts "mooo!"
end
@xenda
xenda / index.html
Created November 11, 2011 23:45
application.html.erb
<body>
<div class="container" data-role="page" data-add-back-btn="true" class"page-map">
<header data-role="header" data-position="fixed" class="classHeader">
<a href="/directions/services" data-inline="true" data-role="button">Direcciones</a>
</header>
<div id="main" role="main" data-role="content">
<div class='map_canvas' id='map_canvas'></div>
show the Dungeons and Bosses party
Yaraher is playing now
Yaraher is playing now as a Sorcerer
Yaraher gains a new level
Yaraher gains Ruby Control Mastery
Yaraher gains Ruby Control Mastery Level 4
Yaraher learns Ruby Exceptions Level 2
@xenda
xenda / xenda_recipe.rb
Created November 3, 2011 15:59
Xenda Rails Recipe
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by RailsWizard, the amazing and awesome Rails
--view, assuming it's named "numbers/number.html.erb"
<%= form_tag "/somewhere" do %>
<%= text_field_tag "number %>
<%= submit_tag "Send" %>
<%= submit_tag "Send2" %>
<% end %>
<% if @result %>
<%= @result %>
c = [["student","sam"], ["student","george"], ["teacher","matz"]]
c.uniq!{ |s| s.first } #=> [["student", "sam"], ["teacher", "matz"]]
class Toss
attr_accessor :cubes
#Toss
def groups_size(n)
counts = cubes.group_by(&:face_up).map { |face, cubes| [face, cubes.size] }
counts.select { |face, count| count == n }.map(&:first)
end
end
# Original
(self.index('"') == 2 || self.index("'") == 2) ? true : false
# First iteration
[self.index('"'),self.index("'")].include? 2 ? true : false
# Second iteration
[self.index('"'),self.index("'")].include? 2 # de por sí ya eso retorna true o false
# Third iteration, self isn't needed
# Python
from twython import Twython
usuario = "ajamaica"
twitter = Twython()
followers = twitter.getFollowersIDs( screen_name = usuario )
for follower_id in followers :
print "Usuario %d sigue a %s" % (follower_id,usuario)