- http://github.com/DanialK/ReactJS-Realtime-Chat
- http://github.com/DanialK/danialk.github.com
- http://github.com/ENCODE-DCC/encoded
- http://github.com/Khan/khan-api
- http://github.com/Khan/perseus
- http://github.com/LukasRychtecky/este-library
- http://github.com/Pirob/react
- http://github.com/alexyoung/dailyjs
- http://github.com/andreypopp/react-dom-events
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.config(time: 5, warmup: 2) | |
| x.report('foo') do |times| | |
| end | |
| x.report('bar') do |times| |
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' | |
| foo = { foo_1: 'one', foo_2: 'two' } | |
| bar = { bar_1: 'one', bar_2: 'two' } | |
| Benchmark.ips do |x| | |
| x.config(:time => 5, :warmup => 2) | |
| x.report('merge!') do |times| | |
| foo = { foo_1: 'one', foo_2: 'two' } |
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 'active_record' | |
| # Temporary switch to blank rake app, extract required tasks and import them to | |
| # current rake task. Skip seed loader here, as we do not need it for tests. | |
| # More info on AR tasks import: @see https://gist.github.com/drogus/6087979 | |
| def import_active_record_tasks(default_rake_app) | |
| Rake.application = Rake::Application.new | |
| Rake.application.rake_require('active_record/railties/databases') |
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
| # gem install json | |
| # gem install oj | |
| # gem install yajl-ruby | |
| require 'benchmark' | |
| require 'json' | |
| require 'oj' | |
| require 'yajl' | |
| n = 100000 |
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 ($) { | |
| /** | |
| * @function | |
| * @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM | |
| * @param {function} handler A function to execute at the time when the element is inserted | |
| * @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation | |
| * @example $(selector).waitUntilExists(function); | |
| */ |
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.config(:time => 5, :warmup => 2) | |
| x.report("select in batches and lookup using the id") do | |
| User.find_in_batches(:conditions => ["updated_at > ?", 8.weeks.ago.to_s(:db)], :select => :id) do |users| | |
| users.map { |user| User.find(user.id, :include => [:user_metric]).id } | |
| end | |
| end |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft,elem.offsetTop,elem.offsetWidth,elem.offsetHeight,elem.offsetParentelem.clientLeft,elem.clientTop,elem.clientWidth,elem.clientHeightelem.getClientRects(),elem.getBoundingClientRect()
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
| .nav-tab { | |
| ... | |
| // instead of putting it on | |
| border-right: 1px solid #424242; | |
| &:last-child { | |
| border-right: 0; // and then taking it off | |
| } | |
| // use CSS not() to only apply to the elements you want | |
| &:not(:last-child) { | |
| border-right: 1px solid #424242; |