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
diff --git a/Gemfile b/Gemfile | |
index aa19617..fa847b7 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -21,6 +21,7 @@ gem 'slim' | |
# Padrino Stable Gem | |
gem 'padrino', '0.12.2' | |
+gem 'rack-parser' | |
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
diff --git a/padrino-core/lib/padrino-core/reloader.rb b/padrino-core/lib/padrino-core/reloader.rb | |
index d157017..f990c6d 100644 | |
--- a/padrino-core/lib/padrino-core/reloader.rb | |
+++ b/padrino-core/lib/padrino-core/reloader.rb | |
@@ -223,6 +223,7 @@ module Padrino | |
files = Set.new | |
files += Dir.glob("#{Padrino.root}/{lib,models,shared}/**/*.rb") | |
reloadable_apps.each do |app| | |
+ next unless app.app_file.start_with?(Padrino.root) | |
files << app.app_file |
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 A | |
attr_writer :foo | |
def test(k) | |
[respond_to?(:"#{k}="), respond_to?("#{k}=")] | |
end | |
end | |
a = A.new | |
p a.respond_to?(:test) #=> true | |
p a.respond_to?("test") #=> true |
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
require 'fileutils' | |
require 'RMagick' | |
require 'streamio-ffmpeg' | |
class Turmeric | |
DEFAULT_OPTIONS = { | |
tmp_dir: "./tmp/", | |
resolution: "200x100", | |
duration: ->(movie){ movie.duration.to_i.times } | |
}.freeze |
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
require 'forwardable' | |
class Regexp | |
class Trie | |
def self.union(*patterns) | |
trie = new | |
patterns.each { |pattern| trie << pattern } | |
trie.to_regexp | |
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
def a(**options) | |
options | |
end | |
def b(**options) | |
a(foo: true, **options) | |
end | |
# 2.1だと{:foo=>true}, 2.2だと{:foo=>false}が出力される。 | |
# 2.1が正しいように思う。 |
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
#!/usr/local/bin/ruby | |
require 'net/http' | |
require 'rss' | |
require 'time' | |
require 'lib/simple_cgi.rb' | |
print "Content-Type:text/html\n\n" | |
query = SimpleCGI::query |
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
require 'rss' | |
require 'net/http' | |
require 'uri' | |
require 'time' | |
Net::HTTP.version_1_2 | |
class RSSReader | |
@@http = Net::HTTP |
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
javascript:(function(){ | |
var _d = document; | |
var array = _d.body.innerHTML.match(/("|')([^"']+?\.)(jpg|gif|png|bmp|jpeg)("|')/ig); | |
if(!array) | |
return alert('見つからなかった。'); | |
var exist = {}; | |
for(var i=0; i < array.length; i++) { | |
if(!exist[array[i]]) { | |
_d.write('<img src=' + array[i] + '>'); | |
exist[array[i]] = 1 |
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
function parseObject(obj) { | |
var _d = document, create = function(element) {return _d.createElement(element)} | |
switch(obj.constructor) { | |
case Array: | |
var list = create('ul'); | |
break | |
case Object: | |
var list = create('dl'); | |
break | |
default: |
OlderNewer