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
def get_res(nextу: nil) | |
Cloudinary::Api.resources(direction: 1, next_cursor: nextу, max_results: 500, resource_type: 'video') | |
end | |
def clc_bytes(resp) | |
resp['resources'].each { |r| $sum += r['bytes'] } | |
end | |
resp = get_res; | |
$sum = 0 |
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
def get_res(nextу: nil) | |
Cloudinary::Api.resources(direction: 1, next_cursor: nextу, max_results: 500, resource_type: 'video') | |
end | |
def clc_bytes(resp) | |
resp['resources'].each { |r| $sum += r['bytes'] } | |
end | |
resp = get_res; | |
$sum = 0 |
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
(ql:quickload "trivial-http") | |
(ql:quickload "cl-json") | |
(let ((user (nth 2 (trivial-http:http-get "http://coderwall.com/nashby.json")))) | |
(let ((decoded (json:decode-json user))) | |
(format t "~a~%" (nth 1 decoded)))) |
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
attribute_names.map do |attribute_name| | |
attribute(attribute_name) | |
end.join.html_safe | |
# vs. | |
"".html_safe.tap do |attributes| | |
attribute_names.each do |attribute_name| | |
attributes.safe_concat attribute(attribute_name) | |
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
source 'http://rubygems.org' | |
gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'journey', :git => 'git://github.com/rails/journey.git' | |
gem 'arel', :git => 'git://github.com/rails/arel.git' | |
gem 'sqlite3' | |
# Gems used only for assets and not required |
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
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb | |
index ba882be..b72aaa2 100644 | |
--- a/activerecord/lib/active_record/relation/spawn_methods.rb | |
+++ b/activerecord/lib/active_record/relation/spawn_methods.rb | |
@@ -34,7 +34,7 @@ module ActiveRecord | |
unless @where_values.empty? | |
# Remove duplicates, last one wins. | |
seen = Hash.new { |h,table| h[table] = {} } | |
- merged_wheres = merged_wheres.reverse.reject { |w| | |
+ merged_wheres = merged_wheres.uniq.reverse.reject { |w| |
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
~/projects/rails/actionpack (git)-[master] % git diff 22:23 | |
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb | |
index 1a64b12..58ca5de 100644 | |
--- a/actionpack/lib/action_view/helpers/form_helper.rb | |
+++ b/actionpack/lib/action_view/helpers/form_helper.rb | |
@@ -103,11 +103,6 @@ module ActionView | |
include FormTagHelper | |
include UrlHelper | |
- # Converts the given object to an ActiveModel compliant one. |
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
~/projects/rubinius (git)-[master] % bin/benchmark benchmark/core/array/bench_sort.rb 23:46 | |
=== bin/rbx === | |
sort strings ascending | |
4244.9 (±0.5%) i/s - 21284 in 5.014169s (cycle=313) | |
array sort! strings ascending | |
4207.8 (±0.9%) i/s - 21267 in 5.054594s (cycle=417) | |
sort strings descending with block | |
1397.7 (±0.6%) i/s - 7124 in 5.096934s (cycle=137) | |
sort! strings descending with block | |
1387.8 (±0.9%) i/s - 6987 in 5.035176s (cycle=137) |
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
def suppress_prompt(text) | |
page.evaluate_script 'window.original_prompt_function = window.prompt;' | |
page.evaluate_script "window.prompt = function(msg) { return '#{text}'; }" | |
end | |
def recover_prompt | |
page.evaluate_script('window.prompt = window.original_prompt_function;') | |
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
def nested_all_blank(attributes) | |
attributes.reject { |key, value| ['_destroy', :_destroy].include?(key) && [false, 0, 'f', 'false'].include?(value) }.all? do |_, value| | |
if value.is_a?(Hash) | |
nested_all_blank(value) | |
else | |
value.blank? | |
end | |
end | |
end |
NewerOlder