An incomplete cheatsheet for rails 3. Things are added as they are required.
# http://guides.rubyonrails.org/active_record_validations_callbacks.html
class SomeClass < ActiveRecord::Base
# length| COUNTRIES = [ | |
| "Afghanistan", | |
| "Aland Islands", | |
| "Albania", | |
| "Algeria", | |
| "American Samoa", | |
| "Andorra", | |
| "Angola", | |
| "Anguilla", | |
| "Antarctica", |
| # Amadeusz Juskowiak <[email protected]> 2012 - MIT License | |
| # 1. Put inside helpers do .. end | |
| # 2. Set CACHE_DIR to somewhere writable and private (like CACHE_DIR=File.dirname(__FILE__) + '/tmp' | |
| # 3. Use it! You can use fragment_expire to remove cache with given name. | |
| # | |
| # Example: | |
| # %h1 foo | |
| # = cache_fragment(:report, 300) do | |
| # - data = get_data_slowly |
Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.
plain Git, aka git://github.com/
Does not add security beyond what Git itself provides. The server is not verified.
If you clone a repository over git://, you should check if the latest commit's hash is correct.
| check file slave_running with path /opt/slave_running | |
| if timestamp > 3 minutes then alert |
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success 🎉 | |
| console.log(response); | |
| } catch (error) { | |
| // Error 😨 |