In your command-line run the following commands:
brew doctorbrew update
| # Based on https://steveholgado.com/nginx-for-nextjs/ | |
| # - /var/cache/nginx sets a directory to store the cached assets | |
| # - levels=1:2 sets up a two‑level directory hierarchy as file access speed can be reduced when too many files are in a single directory | |
| # - keys_zone=STATIC:10m defines a shared memory zone for cache keys named “STATIC” and with a size limit of 10MB (which should be more than enough unless you have thousands of files) | |
| # - inactive=7d is the time that items will remain cached without being accessed (7 days), after which they will be removed | |
| # - use_temp_path=off tells NGINX to write files directly to the cache directory and avoid unnecessary copying of data to a temporary storage area first | |
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; | |
| upstream nextjs_upstream { |
In your command-line run the following commands:
brew doctorbrew updateAll 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.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| $base-font-size: 16px; | |
| $base-line-height: 1.5; | |
| // this value may vary for each font | |
| // unitless value relative to 1em | |
| $cap-height: 0.68; | |
| @mixin baseline($font-size, $scale: 2) { |
Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.
####Search, Go to, Navigation ####
Cmd + P - Search file
Cmd + Shift + O - Search everywhere
(I swapped the above two recently because I use Cmd + P to search for files most of the time).
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
| // Requires jQuery of course. | |
| $(document).ready(function() { | |
| $('.show-comments').on('click', function(){ | |
| var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username. | |
| // ajax request to load the disqus javascript | |
| $.ajax({ | |
| type: "GET", | |
| url: "http://" + disqus_shortname + ".disqus.com/embed.js", | |
| dataType: "script", |
| <?php | |
| /* Example Usage: | |
| * bt_add_image_size( 'product-screenshot', 300, 300, array( 'left', 'top' ) ); | |
| * bt_add_image_size( 'product-feature', 460, 345, array( 'center', 'top' ) ); | |
| */ | |
| add_filter( 'intermediate_image_sizes_advanced', 'bt_intermediate_image_sizes_advanced' ); | |
| add_filter( 'wp_generate_attachment_metadata', 'bt_generate_attachment_metadata', 10, 2 ); | |
| /** |