This file contains hidden or 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> | |
<script> | |
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? | |
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarge |
This file contains hidden or 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
# Given this is the definition of Symbol#to_proc as was added | |
# in ActiveSupport (and in the Ruby Extensions project before | |
# that) and later added to core Ruby 1.9 in C... | |
class Symbol | |
def to_proc | |
proc { |obj| obj.send(self) } | |
end | |
end |
This file contains hidden or 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 String | |
end | |
class JSONString < String | |
def parse | |
JSON.parse(self) | |
end | |
end |
This file contains hidden or 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 Enumerable | |
class Proxy | |
instance_methods.each do |method| | |
next if method.to_s =~ /\A__(id|send)__\Z/ | |
undef_method(method) | |
end | |
def initialize(target, method=:map) | |
@target, @method = target, method | |
end | |
private |
This file contains hidden or 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 Module | |
# just like include except it makes sure to find all | |
# the modules that have already included self and | |
# update those features with the given module. | |
def include_hard(include_me) | |
include include_me | |
ObjectSpace.each_object(Module) do |some_module| | |
next unless some_module.included_modules.include?(self) | |
next if some_module.included_modules.include?(include_me) | |
some_module.class_eval { include include_me } |
This file contains hidden or 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 Name | |
def client | |
ApiClient.new | |
end | |
# this puts the instance method 'client' on Name. | |
# otherwise you should have said def self.client | |
extend self |
This file contains hidden or 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/bin/ruby | |
require 'rubygems' | |
require 'data_objects' # current master @ ed1ceefc | |
require 'dm-core' # current master @ 73860575 | |
require 'dm-migrations' # current master @ ab608e81 | |
class Order | |
include ::DataMapper::Resource |
This file contains hidden or 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 Render::Scope | |
include ErbHelpers | |
def initialize(context) | |
@context=context | |
end | |
def binding | |
(proc { }).binding |
This file contains hidden or 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
<form action="//ds.mydomain.com/" | |
enctype="multipart/form-data" | |
method="post"> | |
<input name="callback" | |
type="hidden" | |
value="http://someapp.mydomain.com/upload_result" /> | |
<input name="my_file_param" | |
type="file" /> |