Skip to content

Instantly share code, notes, and snippets.

View nomnel's full-sized avatar

nomnel nomnel

View GitHub Profile
!!!
%html
%head
- page_title = yield :title
%title= (page_title.present? ? "#{page_title} - " : '') + 'SITE_NAME'
- title @post.title
- if hoge?
.image= image_tag hoge.url, id: 'hoge'
- else
%img.image{id: 'hoge', style: 'display:none'}
if hoge?
image_tag hoge.url, id: 'hoge'
else
image_tag nil, id:'hoge', style: 'display:none'
end
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
module ActionView
module Helpers
module FormTagHelper
alias_method :original_submit_tag, :submit_tag
def submit_tag(value=nil, options={})
options[:disable_with] = options[:disable_with] == '' ? nil : 'Sending...'
original_submit_tag value, options
end
end
end
# coding: utf-8
require 'spec_helper'
feature 'Create new story', js: true do
background do
visit '/users/sign_in'
within("#new_user") do
fill_in 'user[email]', with: '[email protected]'
fill_in 'user[password]', with: 'testtest'
end
@nomnel
nomnel / delete_instapaper_bookmarks.js
Created May 12, 2013 06:10
InstapaperでひたすらDeleteリンククリックするやつ (しょっちゅう失敗する)
window.confirm = function () { return true; };
xs = document.getElementsByClassName("deleteLink");
for (var i = xs.length - 1; i >= 0; i--) {
xs[i].click();
}
location.reload();
@nomnel
nomnel / foo.coffee
Last active December 17, 2015 17:48
$.ajax
type: 'get'
url: '画像のURL'
success: ->
そのまま表示
error: ->
デフォルト画像を表示
@nomnel
nomnel / a.rb
Last active December 18, 2015 02:29
Ranking.constants
=> [:GeneratedFeatureMethods, :ClassMethods, :ConnectionSpecification, :OrmAdapter, :COLUMNS, :Statements,
:TableDefinition, :CommandRecorder, :AttachmentContentTypeValidator, :HelperMethods, :AttachmentPresenceValidator,
:AttachmentSizeValidator, :Defining, :Running, :SingletonMethods, :InstanceMethods, :TransactionError,
:MacroReflection, :AggregateReflection, :AssociationReflection, :ThroughReflection, :Serializer, :ASSOCIATION_TYPES,
:AssociationBuilderExtension, :TooManyRecords, :UNASSIGNABLE_KEYS, :InstanceMethodsOnActivation, :Middleware,
:Association, :SingularAssociation, :CollectionAssociation, :CollectionProxy, :BelongsToAssociation,
:BelongsToPolymorphicAssociation, :HasAndBelongsToManyAssociation, :HasManyAssociation, :HasManyThroughAssociation,
:HasOneAssociation, :HasOneThroughAssociation, :ThroughAssociation, :Builder, :Preloader, :JoinDependency,
:AssociationScope, :AliasTracker, :JoinHelper, :CALLBACKS, :Attribute, :ATTRIBUTE_TYPES_CACHED_BY_DEFAULT,