Skip to content

Instantly share code, notes, and snippets.

View nomnel's full-sized avatar

nomnel nomnel

View GitHub Profile
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
if hoge?
image_tag hoge.url, id: 'hoge'
else
image_tag nil, id:'hoge', style: 'display:none'
end
- if hoge?
.image= image_tag hoge.url, id: 'hoge'
- else
%img.image{id: 'hoge', style: 'display:none'}
- title @post.title
!!!
%html
%head
- page_title = yield :title
%title= (page_title.present? ? "#{page_title} - " : '') + 'SITE_NAME'
module ApplicationHelper
def title(page_title)
content_for(:title) {page_title}
page_title
end
end
@nomnel
nomnel / html2md.scm
Created March 27, 2013 16:34
カレントディレクトリ内のhtmlファイルからmarkdownファイルを作成するシェルスクリプトファイルを作る。 pandoc 1.11.1 Gauche 0.9.3.3
(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)
try_go = (obj, func) ->
moved = false
console.log 'start'
$(window).on 'unload', ->
moved = true
console.log 'unload'
func()
#header
.app_nav
ul
li
a
&.pressed
color: $red
&.disable
opacity: .3
@nomnel
nomnel / 1.rb
Last active December 15, 2015 02:08
[プログラミング入門 - Rubyを使って -](http://www.ie.u-ryukyu.ac.jp/~kono/software/s04/tutorial/)の練習問題
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}歳"