Skip to content

Instantly share code, notes, and snippets.

View epidemian's full-sized avatar

Demian Ferreiro epidemian

View GitHub Profile
f=IO. read(
__FILE__) .gsub(/[^
\s]/x,?#);s= $**'loves';s
.upcase!;i=1;a =s.chars.uniq.
map{|c|s.count(c)};loop{b='';
b<<"#{a.shift.to_i+a.pop.to_i
}"while(a.any?);d=b.to_i;a=
b.chars;d<101&&abort(d>
50?f:f.gsub(/^.*/){
|s|i=13+i%3;s[\
v=$*
def p*a;puts a*' 'end
loop{a,b=v[0],v[6]
w=v.map &:to_i
p a,:attacks,b+?!
w[11]*rand/2>w[4]*rand ? (p b,:dodges!):(h=v[7]=w[7]-=d=[rand(w[2])-rand(w[9])/2,1].max
p a,:hits,b,:for,d,:damage!
p b,:has,h<1?"been slain!":"#{h} health left."
h<1&&exit)
v.rotate!6}
<!DOCTYPE html>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/coffee-script/1.7.1/coffee-script.min.js"></script>
<script src="owl.coffee" type="text/coffeescript"></script>
a=$<.map{|l|l.split.sort}
p a.count{|s|1==a.count(s)}-1
$F.map(&:size).max.times{|i|puts$F.map{|s|s[i]||' '}.join' '}
@epidemian
epidemian / 0_super.rb
Created October 31, 2014 20:25
Code snippets for a Suma lightning talk
module Greeting
def greet(who)
"Hello #{who}"
end
end
class Hacker
include Greeting
def greet(who)
class Mapper < BasicObject
def initialize(enumerable)
@enumerable = enumerable
end
def method_missing(*args, &block)
@enumerable.map { |o| o.public_send(*args, &block) }
end
end
@epidemian
epidemian / es.txt
Last active November 14, 2018 18:59
Top 10000 Spanish words from subtitles. Taken from https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists#Spanish
que
de
no
a
la
el
es
y
en
lo
--color
--require spec_helper
# "Proof" of https://twitter.com/tweetsauce/status/965259567322943490
# 1 = 1!
# 2 = 2!
# 145 = 1! + 4! + 5!
# 40,585 = 4! + 0! + 5! + 8! + 5!
# These are the only four numbers with this property.
# Store the factorials from 0 to 9 for later use.
factorials = (0..9).map {|n| (1..n).inject(:*) || 1 }