πΆ
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
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| FactoryGirl.lint | |
| 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
| Project.joins(βLEFT OUTER JOIN comments | |
| ON comments.polycomment_id = projects.id | |
| AND comments.polycomment_type=βprojectβ | |
| LEFT OUTER JOIN issues ON issues.project_id = projects.id | |
| AND issues.status=1β) | |
| .where(βcomments.created_at > ? | |
| OR issues.updated_at > ?β, 10.days.ago, 10.days.ago) | |
| .group(βprojects.idβ) | |
| .order(βcount(comments.polycomment_id)+4*count(issues.project_id) | |
| descβ) |
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
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| FactoryGirl.lint if CONFIG['factory_girl_lint'] | |
| 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
| pg_dump -U postgres -t table_name origin_db_name | psql -U postgres dest_db_name |
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
| function createCORSRequest(method, url) { | |
| var xhr = new XMLHttpRequest(); | |
| if ("withCredentials" in xhr) { | |
| // XHR for Chrome/Firefox/Opera/Safari. | |
| xhr.open(method, url, true); | |
| } else if (typeof XDomainRequest != "undefined") { | |
| // XDomainRequest for IE. | |
| xhr = new XDomainRequest(); | |
| xhr.open(method, url); | |
| } else { |
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
| RubyProf.start | |
| # code to profile | |
| result = RubyProf.stop | |
| printer = RubyProf::CallStackPrinter.new(result) | |
| # to save results to tmp/profile_data.html | |
| File.open("/home/addie/some/profile_data.html", 'w') { |file| printer.print(file) } |
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
| document.getElementsByTagName("video") [0].playbackRate = 1.7; |
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
| S.no | rubygem name | home link | |
| 1 xmlresume2x: xmlresume2x.rubyforge.org | |
| 2 xen: ruby-xen.rubyforge.com | |
| 3 xbm_ruby: http://xbm_ruby.rubyforge.org | |
| 4 x2c: forti.ath.cx:20480 | |
| 5 weather_report: Homepage:: http://www.cordinc.com/projects/weather_report | |
| 6 valentine: FIX (url) | |
| 7 user_query: http://user_query.rubyforge.org | |
| 8 url-vi0lence: url-vi0lence.rubyforge.com | |
| 9 tuxdroid: by Andrew Montgomery |
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/ips' | |
| Benchmark.ips do |x| | |
| x.report("reverse_dependencies_name") do | |
| # inspect or else it will benchmark just the creation of sql query | |
| # and not the execution | |
| Version.reverse_dependencies('rails').inspect | |
| end | |
| x.report("reverse_dependencies_id") do |
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/ips' | |
| Benchmark.ips do |x| | |
| x.report("update_gem_downloads") do | |
| updates_by_gem = {31141=>81, 55109=>36, 75586=>72, 27046=>72, 78002=>24, 80114=>62, 88344=>43, 91314=>40, 112811=>78, 74471=>3, 37936=>83, 85831=>32, 19193=>73, 106461=>26, 92080=>84, 23033=>23, 28444=>32, 69808=>25, 111504=>30, 114083=>87} | |
| GemDownload.update_gem_downloads(updates_by_gem) | |
| end | |
| x.report("update_gem_downloads_old") do | |
| updates_by_gem = {45908=>91, 80612=>46, 59193=>29, 72913=>65, 25443=>82, 59819=>60, 85201=>42, 42041=>67, 51804=>34, 43622=>86, 64017=>52, 41448=>6, 108872=>24, 28863=>15, 54962=>51, 74408=>71, 70542=>9, 27849=>5, 97372=>0, 34692=>55} |