Skip to content

Instantly share code, notes, and snippets.


D.E. Akers 0x0dea

  • North Carolina, US
View GitHub Profile
View foo.rb
require 'open3'
i, o = Open3.popen2 'ruby repl.rb'
line = nil
puts 'Gimme Ruby expressions to evaluate (in another process).' do
i.puts line while line = gets
View kiru_kata.rb
require 'minitest/autorun'
require 'minitest/pride'
# Given a flat array of positive integers, partition it into three sub-arrays
# whose sums are 5, 7, and 5, respectively, or nil if doing so is impossible.
# The argument is the syllable (mora) count of each word in some phrase, and
# the purpose of this method is cutting (kiru) the phrase into chunks which
# satisfy the 5-7-5 rule imposed upon modern haiku.
def kiru morae
View mnemo
#!/usr/bin/env ruby
#/ Usage: mnemo [filename]
#/ Options:
#/ -h, --help Show this help message
#/ -v, --version Show application version
VERSION = "1.0.1"
View here?.rb
print "Wanted to see if you were here today! yes/no? "
def handle_yes
puts "sweet! What time is good for you?"
time = gets.chomp
puts "Right on, I'll see you at #{time}!!"
def handle_no
puts "Sad. Next week it is!"
View find_constant.rb
require 'stringio'
def find_constant const
return nil unless Object.const_defined? const
value = Object.const_get const
$stderr =
Object.const_set const, nil
0x0dea / slowlag.rb
Last active Aug 29, 2015
Hangman autoclicker for #ruby-offtopic (when the category is ruby)
View slowlag.rb
require 'socket'
s = '', 6667
s.puts "NICK slowlag"
s.puts "USER slowlag 0 * :slowlag"
s.puts "JOIN #ruby-offtopic"
all ='all').split("\n")
can = all.dup
0x0dea / composable_ish.rb
Created Jun 28, 2015
Pseudo-class composition in Ruby.
View composable_ish.rb
module Composable
extend self
def extended klass
klass.send :attr_reader, :val
def method_missing klass
f, g = self, const_get(klass)
0x0dea / enumerable_all.rb
Created Jun 17, 2015
Improved Enumerable#all?
View enumerable_all.rb
module Enumerable
def all? p = nil
pred = block_given? ? proc : -> x { p ? p === x : x }
each { |obj| return false unless pred[obj] }
0x0dea / enum.patch
Created Jun 17, 2015
Add case equality checks to Enumerable#any?/all?/none?/one?.
View enum.patch
diff --git a/enum.c b/enum.c
index 4b1e119..c717540 100644
--- a/enum.c
+++ b/enum.c
@@ -1043,7 +1043,7 @@ enum_sort_by(VALUE obj)
return ary;
-#define ENUMFUNC(name) rb_block_given_p() ? name##_iter_i : name##_i
+#define ENUMFUNC(name, argc) argc ? name##_eqq : rb_block_given_p() ? name##_iter_i : name##_i
0x0dea / datg
Created Jun 14, 2015
Download all the gems!
View datg
gem search --no-vers | parallel -j0 -I$ 'curl -O `curl$.json | jq -r .gem_uri`'
You can’t perform that action at this time.