To conditionally display a field based on a value in the displayed object, you can do the following: RailsAdmin.config do |config| config.model YourObject do edit do field :some_random_attribute do visible do bindings[:object].your_conditional_field=="your_conditional_value" end end end end end   In this Rails Admin configuration example, you can see that the YourObject#some_random_attribute field will only display if the YourObject object being displayed satisfies the condition within the “visible” block, otherwise it will [...]
Read More
To create a custom rails_admin dashboard, first create a new file here: lib/rails_admin.rb   And in your rails_config/initializers/rails_admin.rb initializer file, be sure to include the above file: RailsAdmin.config do |config| require Rails.root.join('lib', 'rails_admin.rb') end   Within this new file, do the following: module RailsAdmin module Config module Actions class Dashboard < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) register_instance_option :root? do true end register_instance_option :breadcrumb_parent do nil end register_instance_option :controller do proc do #You can [...]
Read More
When using the CSS3 font-size (viewport) units, such as vw and vh, you may have noticed that the fonts can become very small on smaller screens. To resolve this issue, you can do the following: @media screen and (max-width: 1100px){ font-size:35px; } @media screen and (min-width: 1101px){ font-size: 3vw; }   Using the media queries above, we can specify a fixed font-size of 35px for screen sizes under 1100px (for [...]
Read More
To install the Eurlerian Video Magnification software on Ubuntu 14.04, you’ll want to do the following: First, download the associated software here: http://people.csail.mit.edu/mrub/evm/bin/EVM_Matlab_bin-1.1-linux64.zip Then move the associated zip to your preferred location and unzip. You will also need the Matlab Runtime environment (not the actual matlab suite), which can be downloaded here: http://people.csail.mit.edu/mrub/evm/bin/MCR_R2012b_glnxa64_installer.zip To install the matlab runtime environment, move the zip to your preferred location and unzip. At this [...]
Read More
To install Android Studio on Ubuntu 14.04, complete the following steps: First, download the Android Studio here: http://developer.android.com/sdk/index.html   The Android Studio requires Java’s JDK 6 or above (preferably 7), so you’ll want to do the following at your command line: sudo apt-get install openjdk-7-jre sudo apt-get install openjdk-7-jdk   Or, if you prefer to use the Android Studio recommended Oracle JDK, you can do the following: sudo apt-get install [...]
Read More
If you’re running into a rails migration exception, such as: column “x” of relation “y” already exists Then you can conditionally run the associated migration in the following way: YourModel.reset_column_information unless YourModel.column_names.include?("the_column") add_column(:your_models, :the_column, :boolean, :default=>true) end   Of course, it is probably best to address the underlying workflow issues that caused this issue to occur in the first place. However, if you just want to move along to get [...]
Read More
To check a checkbox after clicking a table’s tr element, do the following: $(document).on("click",".your-tr-element",function(event){ checkbox = $(this).find("input:checkbox"); if(event.target.type!="checkbox"){ if($(checkbox).prop("checked") == true){ $(checkbox).prop("checked",false); }else{ $(checkbox).prop("checked",true); } } });   By retaining the event in the callback function, we’re able to ensure the clicked element is not the checkbox itself. This will solve the issue of effectively clicking the checkbox twice and reverting the intended functionality.
Read More