To kill an invisible thunderbird process, you can do the following: killall thunderbird
Author: anthony
Rails Admin: Conditionally display a field based on a specific object’s value
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 […]
Rails Admin Custom Dashboard
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? […]
Grep count all occurrences found
You can use Grep to count all occurrences of a string with the following cat * | grep -c [search] .
Install RMagick on Ubuntu 14.04
If you’re running into the following error when attempting to install the RMagick gem: ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. Be sure to install the dependencies, then try again. sudo apt-get install imagemagick sudo apt-get install libmagickwand-dev After which you should be good to go.
How to set a minimum font size when using CSS3 vw or vh
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 […]
MIT’s Eulerian Video Magnification on Ubuntu 14.04
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 […]
Install Android Studio on Ubuntu 14.04
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 […]
Rails conditional migrations – ensure column does not exist
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 […]
Check checkbox with tr element
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 […]