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
module ActionView | |
module Helpers | |
module FormTagHelper | |
alias_method :original_submit_tag, :submit_tag | |
def submit_tag(value=nil, options={}) | |
options[:disable_with] = 'Sending...' unless options[:disable_with] | |
original_submit_tag(value, options) | |
end | |
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
if hoge? | |
image_tag hoge.url, id: 'hoge' | |
else | |
image_tag nil, id:'hoge', style: 'display:none' | |
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
- if hoge? | |
.image= image_tag hoge.url, id: 'hoge' | |
- else | |
%img.image{id: 'hoge', style: 'display:none'} |
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
- title @post.title |
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
!!! | |
%html | |
%head | |
- page_title = yield :title | |
%title= (page_title.present? ? "#{page_title} - " : '') + 'SITE_NAME' |
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
module ApplicationHelper | |
def title(page_title) | |
content_for(:title) {page_title} | |
page_title | |
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
(use file.util) | |
(let1 html-files (filter (^f (string=? "html" (cadr (string-split f ".")))) | |
(directory-list (current-directory))) | |
(call-with-output-file "script.sh" | |
(^p (dolist (f html-files) | |
(display (string-append "pandoc -f html -t markdown_github " | |
f " -o " | |
(string-append (car (string-split f ".")) ".md")) | |
p) |
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
try_go = (obj, func) -> | |
moved = false | |
console.log 'start' | |
$(window).on 'unload', -> | |
moved = true | |
console.log 'unload' | |
func() |
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
#header | |
.app_nav | |
ul | |
li | |
a | |
&.pressed | |
color: $red | |
&.disable | |
opacity: .3 |
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
puts "1年は#{365 * 24}時間です" | |
puts "10年間は#{60 * 24 * 365 * 10}分です" | |
puts "生まれてから#{Time.new - Time.mktime(1986, 1, 1)}秒経っている" | |
puts "80年生きるとして、#{(80 * 365) / 7}枚ぐらいかな" | |
puts "10億3400万秒生きてるとしたら#{1034000000 / 60 / 60 / 24 / 365}歳" |