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
# patch for make ruby error | |
# % rbenv install 1.8.7-p375 | |
# ... | |
# ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function) | |
# ossl_pkey_ec.c:815: error: (Each undeclared identifier is reported only once | |
# ossl_pkey_ec.c:815: error: for each function it appears in.) | |
# make[1]: *** [ossl_pkey_ec.o] error 1 | |
# ... | |
# | |
# refs: http://forums.cpanel.net/f5/case-84173-error-installing-ruby-377831.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
def associations_for_includes(recursive: true, except: nil, _breadcrumb: []) | |
_breadcrumb << self.class_name | |
self.reflect_on_all_associations.map do |association_reflection| | |
association_name = association_reflection.name | |
class_name = association_reflection.class_name | |
next if _breadcrumb.include?(class_name) | |
next if association_reflection.options.has_key?(:polymorphic) | |
case except |
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
# code_hunter: https://github.com/r7kamura/code_hunter | |
task :code_hunter do | |
report_yaml = `code_hunter --application-path=#{Rails.root}` | |
successed_flag = YAML.load(report_yaml).empty? | |
puts "\e[31m#{report_yaml}\e[0m" unless successed_flag | |
exit successed_flag | |
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
# refs http://crypt.codemancers.com/posts/2013-07-12-redefine-rake-routes-to-add-your-own-custom-tag-in-Rails/ | |
# | |
# for re-defining the Rake task | |
# otherwise the previous Rake task is still called | |
ADDITIONAL_NOTES = %w( hack xxx ) | |
task(:notes).clear | |
desc "Enumerate all annotations (use notes:optimize, :fixme, :todo, :#{ADDITIONAL_NOTES.join(', :')} for focus)" | |
task :notes do |
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
# 特異クラスを取得 | |
def eigenclass | |
class << self; self; end | |
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
class Maybe < BasicObject | |
UNPROXIED_METHODS = %i(__send__ __id__ send object_id extend instance_eval initialize block_given? raise caller method) | |
delegate *(::NilClass.instance_methods - UNPROXIED_METHODS), to: :@just | |
def initialize(obj) | |
@just = obj | |
end | |
# for debug |
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
# refs: http://dennisreimann.de/blog/referencing-rails-assets-in-coffeescript/ | |
<% | |
image_path_map = {} | |
Dir.chdir("#{Rails.root}/app/assets/images/") do | |
image_path_map = Dir.glob('**/*').inject({}) do |result, filepath| | |
next result if File::ftype(filepath) == 'directory' | |
result.merge(filepath => image_path(filepath)) | |
end | |
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
// | |
// usage: | |
// gcc -o GHOST GHOST.c | |
// ./GHOST | |
// | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> |
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
#!/bin/sh | |
# requirements: kldload speaker | |
echo 'CDE ~ CDE ~ GEDCDED ~ CDE ~ CDE ~ GEDCDEC ~ GGEGAAG ~ EEDDL2C' > /dev/speaker |
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
Category.roots.map do |root| | |
tree = [] | |
root.class.each_with_level(root.self_and_descendants) do |category, level| | |
tree << "#{' ' * level}#{category.name}" | |
end | |
tree | |
end.join("\n").display |
OlderNewer