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 RoundTo | |
# def self.included(klass) | |
# if klass.instance_method(:round) | |
# klass.class_eval do | |
# begin | |
# remove_method :round | |
# rescue NameError | |
# end | |
# end | |
# super |
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
$.hasData = function(element, settings){ | |
return !!$(element).data(settings.dataName); | |
} | |
$.extend($.expr[':'], { | |
"rotateable": function(a, i, m) { | |
return $.hasImages(a,{dataName:'images'}); | |
} | |
}); |
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
<fb:prompt-permission perms="email"> | |
<div>Email you</div> | |
</fb:prompt-permission> | |
<div id="other-games"> | |
Play other games | |
</div> | |
<div id="progress"> | |
<fb:bookmark /> | |
</div> |
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 Foo << Sequel::Model | |
extend Forwardable | |
def bar | |
@bar ||= Bar.find(bar_id) | |
end | |
def_delegators :bar, :my, :bar, :methods | |
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 Sequel::Model | |
def_dataset_method :random do |*args| | |
range, size = *args | |
size ||= 1; raise ArgumentError, 'need to specify a range as the first argument' unless range | |
limit(size,rand(range)) | |
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
update fighters foo | |
set user_batting_average = (select (sum(`wins`) / sum(`views`)) | |
from fighters bar | |
where foo.user_id = bar.user_id) | |
where foo.user_id in (select user_id from fighters) |
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
{ scopeName = 'source.ruby.sequel.basic'; | |
fileTypes = ( 'rb' ); | |
patterns = ( | |
{ name = 'meta.function.method.with-arguments.ruby.sequel'; | |
begin = '^\s*(def_dataset_method)\s*'; | |
end = '$'; | |
beginCaptures = { | |
1 = { name = 'keyword.control.def.ruby';}; | |
}; | |
patterns = ( { include = 'source.ruby'; } ); |
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
if Merb.env?('development') | |
def closure_include file | |
includes = File.open(Merb.root_path+'/public/javascripts/'+file).inject([]) do |result,line| | |
if m=line.match(/@code_url (.+)/) | |
path = m[1].gsub(/http:\/\/pictureclubfiles\.omgpop\.com/,'') | |
if path =~ /http/ | |
result << %{<script type="text/javascript" src="#{path}"></script>} | |
else | |
result << %{<script type="text/javascript" src="#{cdn}/javascripts#{path}?#{cdn_version}"></script>} |
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
<a href="#" clicktoshowdialog="fan-dialog" oncancel="console.log('test')">Fan us!</a> | |
<fb:dialog id="fan-dialog"> | |
<fb:dialog-title>Fan OUR GAME!</fb:dialog-title> | |
<fb:dialog-content> | |
<div id="fan-me"> | |
<fb:iframe scrolling="no" frameborder="0" | |
src="http://www.facebook.com/connect/connect.php?id=44856213161&connections=0&stream=0&locale=en_US" | |
allowtransparency="true" | |
style="border: none; width: 300px; height: 64px;" | |
height=64 |
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
require 'benchmark' | |
Benchmark.bmbm do |x| | |
x.report 'each_with_index' do | |
i = [] | |
[*1..1000].each_with_index do |item, index| | |
i << item*index | |
end | |
end | |