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 getElementsByClassName-1.0.1 | |
//= require domready | |
//= require_tree ./widget |
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
<script type="text/javascript" src="http://assets.doorkeeper.jp/assets/widget.js"></script> | |
<a class="doorkeeper-registration-widget" href="http://apicommunity.doorkeeper.jp/events/773">Register for Javascript Widget Demo</a> |
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() { | |
<%= File.read(Rails.root.join("vendor/assets/javascripts/getElementsByClassName-1.0.1.js")) %> | |
<%= File.read(Rails.root.join("vendor/assets/javascripts/ready.js")) %> | |
domready(function() { | |
var widget_link, iframe, i, widget_links; | |
widget_links = getElementsByClassName('doorkeeper-registration-widget'); | |
for (i = 0; i < widget_links.length; i++) { | |
widget_link = widget_links[i]; | |
iframe = document.createElement('iframe'); | |
iframe.setAttribute('src', widget_link.href + "/widget.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
escaped = CGI.unescape(query) | |
return escaped if escaped.valid_encoding? | |
%w[EUC-JP Shift_JIS].each do |encoding| | |
s = escaped.force_encoding(encoding) | |
return s.encode("UTF-8") if s.valid_encoding? | |
end | |
escaped |
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 Invoice < ActiveRecord::Base | |
belongs_to :sender | |
after_initialize :assign_defaults | |
def assign_defaults | |
if new_record? && sender | |
self.fax ||= sender.fax | |
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
Started GET "/assets/application.js" for 127.0.0.1 at 2011-06-22 18:54:39 +0900 | |
Compiled app/assets/javascripts/application.js (4ms) (pid 65649) | |
Compiled ~/.rvm/gems/ruby-1.9.2-p180/gems/jquery-rails-1.0.11/vendor/assets/javascripts/jquery.js (1ms) (pid 65649) | |
Compiled ~/.rvm/gems/ruby-1.9.2-p180/gems/jquery-rails-1.0.11/vendor/assets/javascripts/jquery_ujs.js (0ms) (pid 65649) | |
Compiled vendor/assets/javascripts/externals.js (2ms) (pid 65649) | |
Compiled vendor/assets/javascripts/jshashtable-2.1.js (0ms) (pid 65649) | |
Compiled vendor/assets/javascripts/jquery.numberformatter-1.2.2.min.js (0ms) (pid 65649) | |
Compiled app/assets/javascripts/invoices.coffee (119ms) (pid 65649) | |
Compiled app/assets/javascripts/application.js (0ms) (pid 65649) | |
Served asset /application.js - 304 Not Modified (150ms) (pid 65649) |
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 ids = $('//[data-fb-id]').map(function(){ | |
return $(this).data("fb-id"); | |
}) | |
$.unique(ids).each(function(){ | |
FB.api('/' + this, function(r){ | |
$("//[data-fb-id='"+ r["id"] + "']").each(function(){ | |
var attr = $(this).data("fb-attr"); | |
$(this).text(r[attr]); |
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
// Based on http://snipt.net/boriscy/datetime-jquery-formtastic/ | |
$.tools.dateinput.localize("ja", { | |
months: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
shortMonths: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月', | |
days: '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日', | |
shortDays: '日,月,火,水,木,金,土' | |
}); | |
$.tools.dateinput.conf.format = 'yyyy-mm-dd'; |
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
odule Authlogic::Session::Timeout::DontLockoutApiKeyOrHttpAuth | |
def self.included(klass) | |
klass.class_eval do | |
dont_lockout = "single_access? || persist_by_http_auth?" | |
before_persisting_callback_chain.detect {|c| c.method == :reset_stale_state }.options.update(:unless => dont_lockout) | |
after_persisting_callback_chain.detect {|c| c.method == :enforce_timeout }.options.update(:unless => dont_lockout) | |
end | |
end | |
end |
NewerOlder